Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Crystal Report - Sub report

Posted on 2010-11-11
2
Medium Priority
?
386 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 2000 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: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

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…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

670 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