i am trying to create and fill crystal report via code but an error occurred, REPORT HAS NO TABLES but when i try to extract data from DATASET then it shows exact data,no problem but doesn't work for Crystal report.
CODE:
protected void Dataset_load()
{
SqlConnection sqlcon = new SqlConnection(conStr);
SqlCommand sqlCom = new SqlCommand("select * from Login", sqlcon);
SqlDataAdapter sqlDA = new SqlDataAdapter(sqlCom);
DataSet ds = new DataSet("CRDataSet");
try
{
sqlcon.Open();
//sqlCom.ExecuteNonQuery();
sqlDA.Fill(ds,"Login");
ReportDocument rd = new ReportDocument();
rd.Load(Server.MapPath("CrystalReport.rpt").ToString());
rd.SetDataSource(ds.Tables["Login"]);
CrystalReportViewer1.ReportSource = rd;
}
catch (Exception exc)
{
Response.Write(exc.Message);
}
finally
{
sqlcon.Close();
}