1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| protected void Button1_Click(object sender, EventArgs e)
{
CrystalDecisions.CrystalReports.Engine.ReportDocument rd = new CrystalDecisions.CrystalReports.Engine.ReportDocument();
//CustomersBLL objBll = new CustomersBLL(); //instantiate the customersBLL
//DataSet ds = new DataSet();
//ds = objBll.CustomersDataSet(); //get all customer information into a dataset
CnxBase a = new CnxBase();
String reqSQL = "SELECT * FROM operation where id_ordre in ( (SELECT id_ordre FROM ordre_avt_titre where ((id_compte_deb='" + Session["compte"] + "') OR (id_compte_cre='" + Session["compte"] + "'))) UNION(SELECT id_ordre FROM ordre_versement_solde where ((id_compte_deb='" + Session["compte"] + "') OR (id_compte_cre='" + Session["compte"] + "'))))";
SqlDataAdapter myDataAdapter = new SqlDataAdapter(reqSQL, a.MyConn );
DataSet myDataSet = new DataSet();
myDataAdapter.Fill(myDataSet,"t_result");
CrystalDecisions.CrystalReports.Engine.ReportDocument cr = new CrystalDecisions.CrystalReports .Engine .ReportDocument ();
string path = Server.MapPath("~\\CrystalReport.rpt"); //path of the crystal report Reports
cr.Load(path); //load the report to the ReportDocument
DataTable dt= myDataSet.Tables[0];
cr.SetDataSource(dt);
CrystalReportViewer1.ReportSource = cr ;
CrystalReportViewer1.RefreshReport ();
} |
Partager