private void pur1_Load(object sender, EventArgs e) { try { string s = PurchaseOrder.abdef; MessageBox.Show(s); string q1 = "SELECT * FROM [pur_detail] where Purchase_orderID='" + s + "'"; SqlCeConnection con = new SqlCeConnection(Properties.Settings.Default.conne); SqlCeCommand cmd1 = new SqlCeCommand(); SqlCeDataAdapter sad = new SqlCeDataAdapter(); DataSet dt = new DataSet(); con.Open(); cmd1.Connection = con; cmd1.CommandText = q1; sad.SelectCommand = cmd1; sad.Fill(dt, "Table[0]"); POR p = new POR(); p.Database.Tables["pur_detail"].SetDataSource(dt.Tables[0]); crystalReportViewer1.ReportSource = null; crystalReportViewer1.ReportSource = p; //ReportDocument crystal = new ReportDocument(); //string path = System.IO.Path.GetDirectoryName(Application.ExecutablePath); //path = System.IO.Directory.GetParent(System.IO.Directory.GetParent(path).ToString()).ToString(); //path = System.IO.Path.Combine(path, "POR.rpt"); //crystal.Load("C:\\VensarkBill\\Rest\\POR.rpt"); //crystal.SetDataSource(dt); //crystalReportViewer1.ReportSource = crystal; //crystalReportViewer1.Refresh(); } catch (Exception exc1) { MessageBox.Show("" + exc1); } }
public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() { POR rpt = new POR(); rpt.Site = this.Site; return(rpt); }