For some reasons I'm getting no data populating in my crystal report. I have set the datasourse of my crystal report to the dataset. I filled my dataset with data straight from the database. My dataset is not empty, I always check it first before populating data to the my report. I built my crystal report off the wzard and I did add crystal report viewer. Please help.

Dani AI

Generated

Brief diagnosis and a focused checklist that addresses the scenario described by and the suggestions from and . The usual causes for a Crystal report showing no data even though the DataSet is filled are: design-time vs runtime data-source mismatch, table/name/schema mismatch, subreports not bound, or the report still trying to pull from the database instead of using the pushed DataSet.

Common causes and what they mean

  • Report built against a live database (pull model): the .rpt will try to query the DB at runtime. Passing a DataSet does nothing unless the report is designed for a pushed DataSet or table logon info is overridden.
  • Design-time schema vs runtime DataSet mismatch: field/table names in the report must match the DataTable names and column names provided at runtime (typed .xsd helps avoid this).
  • Binding order/scope: the DataSet must be filled and still in scope when calling SetDataSource. Filling after binding or disposing the DataSet before render produces empty output.
  • Subreports: each subreport must receive its own data source explicitly; they do not inherit the main report's DataSet.
  • Saved connection or version mismatch: saved DB credentials in the report or mismatched Crystal runtime versions can block the pushed data.

Minimal push-model example (VB.NET)

' create report instance (typed report or load .rpt)
Dim rpt As New MyReport()
' push DataSet (or a single DataTable)
rpt.SetDataSource(myDataSet)           ' or: rpt.SetDataSource(myDataSet.Tables("MyTable"))
crystalReportViewer1.ReportSource = rpt
crystalReportViewer1.Refresh()

' subreport example:
rpt.OpenSubreport("SubreportName").SetDataSource(myDataSet.Tables("SubTable"))

Quick troubleshooting tips: write the DataSet out to XML to confirm structure/content (myDataSet.WriteXml("c:\temp\ds.xml")); use ReportDocument.VerifyDatabase or re-run “Verify Database” in designer when field mappings change; remove or override saved DB logon info if the report keeps trying to connect; ensure the DataTable names exactly match what the report expects. These checks cover the typical gaps highlighted by ’s design-source question and the alternative push/pull approaches mentioned by .

Recommended Answers

All 3 Replies

When you created the report using the wizard, did you point it to a database or directly to your typed dataset (.xsd file)? Im wondering if the report is somehow attempting to pull the data from the db rather then use the dataset set being passed to it. Either way I cant really tell without some examples to see exactly what you have done.

hi,

i can't help u until i see wat u've done...but here's a link... i had the same problem in crystal reports and i searched alot and found this tutorial on msdn and it worked.. just follow the steps accurately.. it won't take time...

http://msdn.microsoft.com/en-us/library/ms227662(v=VS.90).aspx

best ov luk

hi,

i had the same problem in populating data in crystal reports... but i was using c#.net.. here's a link of msdn.com page... just follow the steps in the tutorial accurately... it shows method of binding crystal reports with an object , ado.net and IReader... my problem was solved by IReader method so better try that one first...

http://msdn.microsoft.com/en-us/library/ms227662(v=VS.90).aspx

Best ov luk :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.