Results 1 to 1 of 1

Thread: setting datasource to crystal subreport in vb.net

  1. #1

    Thread Starter
    Member
    Join Date
    Feb 2003
    Posts
    56

    setting datasource to crystal subreport in vb.net

    I have these 2 independent subreports in the main report. But when i run it , the 2nd subreport shows the data and first subreport comes back empty . When I try to have only the first subreport, it shows the right data. I think setting the datasource or something is not right.Can anyone help me? My main report has no other data but only 2 subreports .

    thanks


    Here is the code.

    Dim RD As New MainReport()
    Dim RO As CrystalDecisions.CrystalReports.Engine.ReportObject
    Dim SRO As CrystalDecisions.CrystalReports.Engine.SubreportObject
    Dim SubDoc As CrystalDecisions.CrystalReports.Engine.ReportDocument



    RO = RD.ReportDefinition.Sections.Item("Section3").ReportObjects.Item("subreport1")
    SRO = CType(RO, CrystalDecisions.CrystalReports.Engine.SubreportObject)
    SubDoc = SRO.OpenSubreport(SRO.SubreportName)
    '''Any report property can now be changed in the subreport, like the selection formula
    SubDoc.SetDataSource(DSOrders)


    Dim RO1 As CrystalDecisions.CrystalReports.Engine.ReportObject
    Dim SRO1 As CrystalDecisions.CrystalReports.Engine.SubreportObject
    Dim SubDoc1 As CrystalDecisions.CrystalReports.Engine.ReportDocument

    RO1 = RD.ReportDefinition.Sections.Item("Section3").ReportObjects.Item("subreport2")
    SRO1 = CType(RO1, CrystalDecisions.CrystalReports.Engine.SubreportObject)
    SubDoc1 = SRO1.OpenSubreport(SRO1.SubreportName)
    SubDoc1.SetDataSource(DSOrders2)
    SubDoc.Refresh()
    SubDoc1.Refresh()
    CrystalReportViewer1.ReportSource = RD
    Last edited by sdeepak; May 12th, 2004 at 08:02 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width