-
Feb 7th, 2012, 12:47 PM
#1
Thread Starter
Member
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
-
Feb 7th, 2012, 02:22 PM
#2
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()
-
Feb 7th, 2012, 08:36 PM
#3
Thread Starter
Member
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."
-
Feb 7th, 2012, 09:17 PM
#4
Thread Starter
Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|