Results 1 to 4 of 4

Thread: VB2008 and Crystal Reports

  1. #1

    Thread Starter
    Member
    Join Date
    Jun 2011
    Posts
    52

    VB2008 and Crystal Reports

    I have a dataset, in that dataset I have a query:
    SELECT ID, Name, Price
    FROM tblItems
    WHERE (ID = @Param1)

    I design the report already using the said dataset. I'm trying to generate the report, but i got an error message that the source of the report is invalid. Here is my code on my btnGenerateReport.

    Dim cryRpt As New ReportDocument
    cryRpt.Load("location of my.rptfile")

    Dim DA As New DataSet1TableAdapters.tblTransactionDetailsTableAdapter
    Dim DS As New DataSet1.tblTransactionDetailsDataTable
    ReportViewer.CrystalReportViewer1.ReportSource = DA.Fill(DS, txtID.Text)
    ReportViewer.CrystalReportViewer1.Refresh()
    ReportViewer.Show()


    What's wrong with my codes? Please help me. Thanks

  2. #2
    PowerPoster
    Join Date
    Sep 2005
    Location
    Modesto, Ca.
    Posts
    5,196

    Re: VB2008 and Crystal Reports

    "Reportsource" is suppose to be set to the name of the report. Like this
    Code:
                    Dim rpt As New CrystalReport1
                    Dim ds as New WaterTablesDataSet
                    Dim taU As New WaterTablesDataSetTableAdapters.UsersTableAdapter
                    taU.FillByActiveUsers(Me.ds.users)
                    rpt.SetDataSource(ds)
                    Dim frm As New frmReports
                    frm.CrystalReportViewer1.ReportSource = rpt
                    frm.Show()

  3. #3

    Thread Starter
    Member
    Join Date
    Jun 2011
    Posts
    52

    Re: VB2008 and Crystal Reports

    Dim DA As New DataSet1TableAdapters.tblTransactionDetailsTableAdapter
    Dim DS As New DataSet1.tblTransactionDetailsDataTable
    cryRpt.SetDataSource(DA.FillByTransNumber(DS, Val(lblTransactionNo.Text)))

    ReportViewer.CrystalReportViewer1.ReportSource = cryRpt
    ReportViewer.CrystalReportViewer1.Refresh()
    ReportViewer.ShowDialog()

    I still have an error, "The data source object is invalid."

  4. #4

    Thread Starter
    Member
    Join Date
    Jun 2011
    Posts
    52

    Re: VB2008 and Crystal Reports

    SOLVED! thanks!

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