T
Téo
Hi,
I have created a crytal report based on a table of my SQL Server. Everything
works fine.
I would like now to fill my report with a sql request in the code behind
instead of the table in the crystal report.
But in the following code, the dataset created isn't "used" by the crystal
report wich continues to use the table.
And if i delete the table in the crystal report to use unbound fields, it
doesn't work.
Any idea?
myCR = new CrystalReport1();
myCR.SetDatabaseLogon("sa", "mypassword");
SqlConnection cn=new SqlConnection(accessbdd.chaineSQL);
SqlCommand cmd=new SqlCommand();
cmd.Connection=cn;
cmd.CommandText="SELECT TOP 10 * FROM Table1";
cmd.CommandType=CommandType.Text;
SqlDataAdapter da=new SqlDataAdapter(cmd);
DataSet ds=new DataSet();
da.Fill(ds);
myCR.SetDataSource(ds);
CrystalReportViewer1.ReportSource=myCR;
Thanks.
I have created a crytal report based on a table of my SQL Server. Everything
works fine.
I would like now to fill my report with a sql request in the code behind
instead of the table in the crystal report.
But in the following code, the dataset created isn't "used" by the crystal
report wich continues to use the table.
And if i delete the table in the crystal report to use unbound fields, it
doesn't work.
Any idea?
myCR = new CrystalReport1();
myCR.SetDatabaseLogon("sa", "mypassword");
SqlConnection cn=new SqlConnection(accessbdd.chaineSQL);
SqlCommand cmd=new SqlCommand();
cmd.Connection=cn;
cmd.CommandText="SELECT TOP 10 * FROM Table1";
cmd.CommandType=CommandType.Text;
SqlDataAdapter da=new SqlDataAdapter(cmd);
DataSet ds=new DataSet();
da.Fill(ds);
myCR.SetDataSource(ds);
CrystalReportViewer1.ReportSource=myCR;
Thanks.