Click here to Skip to main content
15,790,267 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am trying to create dynamic crystal report. First I took a dataset,then data table . Then I took a crystal report and bind it with the data Table,within the dataset. Now I am trying to retrieve data from a table at runtime and trying to display them in the crystal report. But I am unable to do that. If anybody help me,I will be great full to him for ever. Thank you

Edit: Added code from comment below.
I use the bellow code. I do not get any error message.
C#
SqlCommand com = new SqlCommand("query string", con);
SqlDataAdapter da = new SqlDataAdapter(com);
DataSet ds = new DataSet1();
DataTable dt = new DataTable();
da.Fill(dt);
ds.Tables[0].Merge(dt);
ReportDocument rdoc = new ReportDocument();
rdoc.Load(Server.MapPath("CrystalReport4.rpt"));
if (ds.Tables[0].Rows.Count > 0)
{
   rdoc.SetDataSource(ds);
   CrystalReportViewer1.ReportSource = rdoc;
}
Posted
Updated 23-May-11 8:35am
v2
Comments
thatraja 23-May-11 12:33pm    
Any error message? if yes then include that in your question.
manabjn 23-May-11 13:24pm    
Sir, i use the bellow code.I do not get any error message.
SqlCommand com = new SqlCommand("query string", con);
SqlDataAdapter da = new SqlDataAdapter(com);
DataSet ds = new DataSet1();
DataTable dt = new DataTable();
da.Fill(dt);
ds.Tables[0].Merge(dt);
ReportDocument rdoc = new ReportDocument();
rdoc.Load(Server.MapPath("CrystalReport4.rpt"));
if (ds.Tables[0].Rows.Count > 0)
{
rdoc.SetDataSource(ds);
CrystalReportViewer1.ReportSource = rdoc;
}
please help me

OK Try my suggestions....


  • Verify database in the report
  • Confirm you have data in the dataset or datatable
  • Give the name for Dataset & Datatable same as in the report.
  • If the table name is Table1 in report then your code should be like below.
    DataTable dt = new DataTable("Table1");

    Also the same to dataset.
    If the dataset name is Dataset1 in report then your code should be like below.
    DataSet ds = new DataSet1("Dataset1");



Further reading
Crystal Report Blank / Empty / Not Displaying. No On-Screen Error, But Event Log ‘ConfigurationErrorsException’ Received[^]

Let me know....
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900