Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Changing XML datasource on a subreport at runtime.

Status
Not open for further replies.

ChubbyArse

Programmer
May 20, 2003
13
GB
Hi All,

I'm attempting, to set the datasource for a report and a subreport on it. I designed the the reports using two XML files, which were generated from .Net datatables.

At runtime, I'm using this code to change the datasource of the two reports, to use datatables (which has been created previously):

Code:
rpt = New rptServiceCardStandard
rpt.SetDataSource(dtReportData)
rpt.OpenSubreport("rptSiteServices_SubReport").SetDataSource(dtReportServices)

(The reports use a different datatable each).

When this is run I get the following error when I try to view the report in a reportviewer object.

Error in formula <Report_Selection>
"{Site_Services.CardNumber} = {?Pm-Service_Card_Standard.CardNumber}"
A number is required here.

The confusing thing is that in design mode in Crystal it runs fine, but when I try to dynamically change the datasources to a datatable it falls over.

Using the code
Code:
rpt.SetDataSource(dtReportData)
works fine when there is one report (no subreport).
Even with the subreport example above, the code runs, but the error occurs when I show the form which contains the report (in a reportviewer).

Thanks

Alex
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top