Click here to Skip to main content
15,886,362 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I want to connect crystal report to sql server ce.So I created data set.I want to add data dynamically to report.
The values from the table is not displaying in report.
My code is shown below.
C#
string qry1 = "select top (1) a.coursename,a.name,a.feespaid,a.admissionid,b.invoicenumber from tb_studentfees a inner join tb_invoice b on a.admissionid=b.admissionid where a.admissionid="+ lbladmissionnumber.Text +" order by b.invoicenumber desc";
               SqlCeDataAdapter da1 = new SqlCeDataAdapter(qry1, con);
               DataTable dt = new DataTable();
               da1.Fill(dt);
               if (dt.Rows.Count > 0)
               {


                   //opening crystal report
                   ReportDocument reportdocument = new ReportDocument();
                   String path1 = HttpContext.Current.Request.PhysicalApplicationPath + "FessReceiptt.rpt";
                   reportdocument.Load(path1);
                   //reportdocument.Load(Server.MapPath("~/FessReceiptt.rpt"));
                   reportdocument.SetDataSource(dt);
                   CrystalReportViewer1.ReportSource = reportdocument;
                   CrystalReportViewer1.RefreshReport();
               }


My parameter field is admissionid.
Posted
Comments
Maciej Los 19-Aug-15 16:24pm    
Have you tried to debug program?
Is there any error message?
sayana3 20-Aug-15 0:22am    
There is no error message but values from the table are not shown in the report.
Maciej Los 20-Aug-15 0:25am    
Are you sure that datatable contains any data? Have you tried to debug the program?
sayana3 20-Aug-15 0:41am    
yes,on debugging data table visualizer displayed one row of data.
Sinisa Hajnal 20-Aug-15 2:20am    
Crystal reports has one little trick for the unwary. You have to name the table same as it is named in the dataset the report is created with.

So if you added dataset Invoice with tables InvoiceHeader and InvoiceItems to the report, you have to pass the dataset with tables names (CASE SENSITIVE) InvoiceHeader and InvoiceItems.

1 solution

 
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