Solved

Crystal Report - Sub report

Posted on 2010-11-11
2
369 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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

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…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

706 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now