Solved

Crystal Report - Sub report

Posted on 2010-11-11
2
379 Views
Last Modified: 2012-05-10
I am trying to pass dataset to subreport in crystal report. Last line of this code gives error object reference error

if (string.IsNullOrEmpty(Convert.ToString(ds)) || ds.Tables[0].Rows.Count == 0)
                {
                    GlobalFormValidations.ShowInformationMsgBox("There Is No Report To Show...");
                    return;
                }

                var DocReport = new ReportDocument();
                var reportPath = Application.StartupPath + "\\Reports\\" + fileName + ".rpt";
                DocReport.Load(reportPath);
               
                DocReport.SetDataSource(ds);
                DocReport.OpenSubreport("rptBanquetBalanceReport.rpt").SetDataSource(ds.Tables[1]);
0
Comment
Question by:GRChandrashekar
  • 2
2 Comments
 
LVL 4

Expert Comment

by:msd1305
ID: 34113123
this condition

if (string.IsNullOrEmpty(Convert.ToString(ds)) || ds.Tables[0].Rows.Count == 0)

checks whether ds.tables[1] has records or not but while setting the datasource of the sub report you are using ds.Tables[0].

So there is a possibility that ds.Tables[0] is empty. Please verify.
0
 
LVL 4

Accepted Solution

by:
msd1305 earned 500 total points
ID: 34113136
------------------my mistake in above. I meant this --------------
this condition

if (string.IsNullOrEmpty(Convert.ToString(ds)) || ds.Tables[0].Rows.Count == 0)

checks whether ds.tables[0] has records or not but while setting the datasource of the sub report you are using ds.Tables[1].

So there is a possibility that ds.Tables[1] is empty. Please verify.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question