Hi,
I want to set data source dynamically to a Crystal Report in C# Winform application..
But when I create the crystal report with
"Using the Report Wizard", it shows all records fields in crystal report..
I checked the SQL Query in Crystal Report -> Right click on "Database Fields" in Field Explorer and then click on "Show SQL Query..."
It show simple connection, which fetch all records from two tables..
How to set that SQL Query dynamically???
I tried to set dataset, when I call the Crystal report, but it does not worked... :-(
My C# code is :-
OleDbConnection con = new OleDbConnection("Provider=Microsoft.jet.oledb.4.0; data source=" + Application.StartupPath + @"\DataInfo1.mdb;Persist Security Info=true;User Id='Admin'; password=;");
con.Open();
OleDbDataAdapter da = new OleDbDataAdapter(@"SELECT ct.custID, c.custName, c.custAdd,ct.custTranDate,ct.custTranType,ct.custPaidAmt,ct.custDueAmt, c.custArea FROM custTransaction ct left JOIN custDetails c ON ct.custID = c.custID where ct.custID='CUST-000002' and ct.custTranDate BETWEEN #2/28/13# AND #3/1/13#", con);
DataSet ds = new DataSet();
da.Fill(ds);
CrystalReport1 cr = new CrystalReport1();
cr.SetDataSource(ds);
this.crystalReportViewer1.ReportSource = new CrystalReport1();
this.crystalReportViewer1.Show();
Please help me.
Thanks in Advanced.