Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Invalid Report Source using Crystal Reports

Status
Not open for further replies.

REDYPS

Programmer
Jun 12, 2003
12
US
I'm relatively new to creating reports via crystal reports. I get a message "Invalid Report Source" when running the following code.

It was my understanding that you could use a data set as a report source. In fact my code is based on a code example from MS(the code example used oledb but my database is sql server).

'setup connection for crystal report
Dim scnReport As New SqlConnection
scnReport.ConnectionString = CONN

'setup sql command for crystal report
Dim scmdReport As New SqlCommand
scmdReport.Connection = scnReport
scmdReport.CommandType = CommandType.Text
scmdReport.CommandText = "SELECT * FROM vwCheckDisposition"
'setup data adapter for crystal report
Dim sdaReport As New SqlDataAdapter
sdaReport.SelectCommand = scmdReport

'setup instance of dsChecks
Dim dsReportData As New dsChecks
sdaReport.Fill(dsReportData, "vbCheckDisposition")

'bind crystal report object with data to the form viewer
crvChecks.ReportSource = sdaReport
 
are you using crystal 9 or 10?

for crystal 10, you can use a crystal report viewer control in a form, and do the following:

dim tempDoc as New CrystalDecisions.CrystalReports.Engine.ReportDocument
tempDoc.Load(System.AppDomain.CurrentDomain.BaseDirectory & "REPORTNAME.rpt") 'load report if it is in bin folder
crvChecks.SetDataSource(dsReportData) crvChecks.ReportSource = tempDoc 'display report on form

then you can do a me.show in the load event of the form, or something.
 
thanks for the info.

I wasn't using a report document. I was just sending the viewer a dataset. None of the code examples I have say anything about using a report document.

Sam
 
yeah, i had to hunt for that myself. glad i could help
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top