I'm using Visual Studio 2005 (vb code) and have a stored procedure (named sp_Pricing) that supplies the data for a Crystal Report.
When I try to run the report, I get this message:
"Invalid object name (sp_Pricing)"
Here's the code I have so far:
Dim Connection As String = ConfigurationManager.ConnectionStrings("SmartConnectionString").ConnectionString
Dim strSQL As String = "Select * From sp_Pricing"
Dim DA As New SqlDataAdapter(strSQL, Connection)
Dim DS As New DataSet
DA.Fill(DS)
'Get the Report Location
Dim strReportPath As String = Server.MapPath("TJH.rpt")
'Check file exists
If Not IO.File.Exists(strReportPath) Then
Throw (New Exception("Unable to locate report file:" & vbCrLf & strReportPath))
End If
'Assign the datasource and set the properties for Report viewer
Dim rptDocument As New CrystalDecisions.CrystalReports.Engine.ReportDocument
rptDocument.Load(strReportPath)
rptDocument.SetDataSource(DS.Tables(0))
CrystalReportViewer1.ReportSource = rptDocument
******
The error code displays on the "DA.Fill(DS)" line.
Can anyone help me with this?
When I try to run the report, I get this message:
"Invalid object name (sp_Pricing)"
Here's the code I have so far:
Dim Connection As String = ConfigurationManager.ConnectionStrings("SmartConnectionString").ConnectionString
Dim strSQL As String = "Select * From sp_Pricing"
Dim DA As New SqlDataAdapter(strSQL, Connection)
Dim DS As New DataSet
DA.Fill(DS)
'Get the Report Location
Dim strReportPath As String = Server.MapPath("TJH.rpt")
'Check file exists
If Not IO.File.Exists(strReportPath) Then
Throw (New Exception("Unable to locate report file:" & vbCrLf & strReportPath))
End If
'Assign the datasource and set the properties for Report viewer
Dim rptDocument As New CrystalDecisions.CrystalReports.Engine.ReportDocument
rptDocument.Load(strReportPath)
rptDocument.SetDataSource(DS.Tables(0))
CrystalReportViewer1.ReportSource = rptDocument
******
The error code displays on the "DA.Fill(DS)" line.
Can anyone help me with this?