Crystal Reports multipal datasets

jvcoach23

Well-known member
Joined
May 22, 2003
Messages
192
Location
Saybrook, IL
I have report and a subreport. I need to use dataset1 for the report.. and
dataset2 for the subreport. the data is not linked. how do I code that.

Ive used 1 dataset before doing this
Dim myReport as new CrystalReport1
myReport.SetDataSource(ds)
CrystalReportViewer1.REportSource=myReport

but how do you do these for two datasets

Thanks
Shannon
 
pendragon said:
Code:
crReportDocument.OpenSubreport("Report Name").Database.Tables[0].SetDataSource(dataset2);


Ill keep working on it.. but here is what I have and Im getting an error.
Unhandled Exception: CrystalDecisions.CrystalReports.Engine.LoadSaveReportException: Load report failed.
at .I(String , EngineExceptionErrorID )
at .E(String , Int32 )

Code:
 Dim myReport As New crJobListSingle
        myReport.SetDataSource(dsAccountListSingle)
        myReport.OpenSubreport("crJobListingleSubJob").Database.Tables(0).SetDataSource(dsJobSingleJob)

Ive also tried this. and still no go
Code:
Dim myReport As New crJobListSingle
        Dim mySubReport As CrystalDecisions.CrystalReports.Engine.ReportDocument

        Try
            mySubReport = myReport.OpenSubreport("crJobListingSubJob")
            mySubReport.SetDataSource(dsJobSingleJob)
            myReport.OpenSubreport("crJobListingleSubJob").SetDataSource(dsJobSingleJob)
            myReport.SetDataSource(dsAccountListSingle)
            Me.CrystalReportViewer1.ReportSource = myReport
        Catch ex As CrystalDecisions.CrystalReports.Engine.EngineException
            Throw ex
        End Try
I am getting the error on trying to open the sub report.
Please advise.
thanks
shannon

Me.CrystalReportViewer1.ReportSource = myReport
 
Last edited by a moderator:
got it.. did a copy and paste of the subreport name and I think that did it.
Code:
  Dim myReport As New crJobListSingle
        Dim mySubReport As CrystalDecisions.CrystalReports.Engine.ReportDocument

        Try
            mySubReport = myReport.OpenSubreport("crJobListsSingleSubJob")
            mySubReport.SetDataSource(dsJobSingleJob)
            myReport.OpenSubreport("crJobListingleSubJob").SetDataSource(dsJobSingleJob)
            myReport.SetDataSource(dsAccountListSingle)
            Me.CrystalReportViewer1.ReportSource = myReport
        Catch ex As CrystalDecisions.CrystalReports.Engine.EngineException
            Throw ex
        End Try
 
Back
Top