Hello!
Does anybody know the correct way to change the datasource of a subreport at runtime using .NET [ASP.NET specifically - if that makes any difference]??
I have included the code I am using at the moment but this doesn't seem to do the biz
When designing the report, I made the datasource the result of a stored procedure and passed through specific criteria. It appears that if I don't use the same criteria at runtime - it just breaks!! [Get a prerender error]
The code:
Any help would be ace
Rob
Does anybody know the correct way to change the datasource of a subreport at runtime using .NET [ASP.NET specifically - if that makes any difference]??
I have included the code I am using at the moment but this doesn't seem to do the biz
When designing the report, I made the datasource the result of a stored procedure and passed through specific criteria. It appears that if I don't use the same criteria at runtime - it just breaks!! [Get a prerender error]
The code:
Code:
'Set main report
crReportMain = New LabReport()
'Prepare data
dsMain = _wsSample.SelectFromSampleMain(Request.QueryString("id"), _sUser, _sPass)
'Change datasource
crReportMain.SetDataSource(dsMain)
'Set up the subreports ready
crReportMain.OpenSubreport(CType(crReportMain.ReportDefinition.ReportObjects.Item("srptMetalAnalysis"), CrystalDecisions.CrystalReports.Engine.SubreportObject).SubreportName).SetDataSource(_wsSample.getElementsAsCrossTab(Request.QueryString("id"), _sUser, _sPass))
crReportMain.OpenSubreport(CType(crReportMain.ReportDefinition.ReportObjects.Item("srptAnalysis"), CrystalDecisions.CrystalReports.Engine.SubreportObject).SubreportName).SetDataSource(_wsSample.SelectAllTestResults(Request.QueryString("id"), _sUser, _sPass))
'Show the outcome of the report on screen
'Assign report to viewer
With crViewer
.ReportSource = crReportMain
.Visible = True
End With
Any help would be ace
Rob