public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() { CrystalReport1 rpt = new CrystalReport1(); rpt.Site = this.Site; return(rpt); }
private void Print_Bill_Load(object sender, EventArgs e) { if (con.State == ConnectionState.Open) { con.Close(); } con.Open(); DataSet1 ds = new DataSet1(); SqlCommand cmd = con.CreateCommand(); cmd.CommandType = CommandType.Text; cmd.CommandText = "select * from Order_User where Id=" + j + ""; cmd.ExecuteNonQuery(); DataTable dt = new DataTable(); SqlDataAdapter da = new SqlDataAdapter(cmd); da.Fill(ds.DataTable1); SqlCommand cmd1 = con.CreateCommand(); cmd1.CommandType = CommandType.Text; cmd1.CommandText = "select * from Order_Item where Order_Id=" + j + ""; cmd1.ExecuteNonQuery(); DataTable dt1 = new DataTable(); SqlDataAdapter da1 = new SqlDataAdapter(cmd1); da1.Fill(ds.DataTable2); da1.Fill(dt1); tot = 0; foreach (DataRow dr2 in dt1.Rows) { tot = tot + Convert.ToInt32(dr2["total"].ToString()); } CrystalReport1 myreport = new CrystalReport1(); myreport.SetDataSource(ds); myreport.SetParameterValue("total", tot.ToString()); crystalReportViewer1.ReportSource = myreport; }