DataReportClass dr = new DataReportClass(); DataView dview1 = new DataView(); sale s = new sale(); String qry, tname = "sale",tname1="sale1"; //form load private void rpt_sale_Load(object sender, EventArgs e) { dview1.Table = dr.LoadReport1(tname,tname1).Tables["Temp"]; s.SetDataSource(dview1); crystalReportViewer1.ReportSource = s; } //This code is in my .class file public DataSet LoadReport1(String tablename,String tbl) { qry = "Select * from " + tablename + ","+tbl+""; ds = db.search(qry); //db is object of my another .class file includes connection string return ds; } public DataSet search(String s) { try { SqlDataAdapter da = new SqlDataAdapter(s, conn); DataSet ds = new DataSet(); da.Fill(ds, "Temp"); return ds; } catch(Exception ex) { throw ex; } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)