gilweber3
asked on
Passing store procedures to crystal reports using vb.net
I'm calling a crystal report that has a store procedure using vb.net 2010 and I get a invalid report file path error on this line of code - cryReport.SetDataSource(sd aCrystal) Full code below.
Private Sub btnGoalsReport_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGoalsReport.Click
Dim cryReport As New ReportDocument
Dim command2 As New SqlCommand
Dim commandCrystal As New SqlCommand
Dim paramCrystal As SqlParameter
Dim RepLocation, strID, strScope As String
RepLocation = "C:\Temp\JJagoe\goal report.rpt"
strID = "EPARCAH"
strScope = "11"
connectionStringCrystal = "Data Source=DRAWER;Initial Catalog=Live_Report_Produc tion;User ID=GT_App;Password=xxxxx"
connectionCrystal = New SqlConnection(connectionSt ringCrysta l)
commandCrystal.Connection = connectionCrystal
commandCrystal.CommandType = CommandType.StoredProcedur e
commandCrystal.CommandText = "SP_EBO_Select_Hierarchy"
paramCrystal = New SqlParameter("@p_network_i d", strID)
paramCrystal.Direction = ParameterDirection.Input
paramCrystal.DbType = DbType.String
commandCrystal.Parameters. Add(paramC rystal)
paramCrystal = New SqlParameter("@p_ScopeType ", strScope)
paramCrystal.Direction = ParameterDirection.Input
paramCrystal.DbType = DbType.String
commandCrystal.Parameters. Add(paramC rystal)
Dim sdaCrystal As New SqlDataAdapter
Dim objGetDataSetCrystal As DataSet = New DataSet()
Try
connectionCrystal.Open()
objGetDataSetCrystal.Accep tChanges()
sdaCrystal.SelectCommand = commandCrystal
sdaCrystal.Fill(objGetData SetCrystal )
commandCrystal.Dispose()
connectionCrystal.Dispose( )
Catch ex As Exception
MsgBox(ex.ToString)
End Try
cryReport.SetDataSource(sd aCrystal) - I get a invalid report file path error on this line
CrystalReportViewer1.Repor tSource = cryReport
cryReport.Load(RepLocation )
CrystalReportViewer1.Refre sh()
Private Sub btnGoalsReport_Click(ByVal
Dim cryReport As New ReportDocument
Dim command2 As New SqlCommand
Dim commandCrystal As New SqlCommand
Dim paramCrystal As SqlParameter
Dim RepLocation, strID, strScope As String
RepLocation = "C:\Temp\JJagoe\goal report.rpt"
strID = "EPARCAH"
strScope = "11"
connectionStringCrystal = "Data Source=DRAWER;Initial Catalog=Live_Report_Produc
connectionCrystal = New SqlConnection(connectionSt
commandCrystal.Connection = connectionCrystal
commandCrystal.CommandType
commandCrystal.CommandText
paramCrystal = New SqlParameter("@p_network_i
paramCrystal.Direction = ParameterDirection.Input
paramCrystal.DbType = DbType.String
commandCrystal.Parameters.
paramCrystal = New SqlParameter("@p_ScopeType
paramCrystal.Direction = ParameterDirection.Input
paramCrystal.DbType = DbType.String
commandCrystal.Parameters.
Dim sdaCrystal As New SqlDataAdapter
Dim objGetDataSetCrystal As DataSet = New DataSet()
Try
connectionCrystal.Open()
objGetDataSetCrystal.Accep
sdaCrystal.SelectCommand = commandCrystal
sdaCrystal.Fill(objGetData
commandCrystal.Dispose()
connectionCrystal.Dispose(
Catch ex As Exception
MsgBox(ex.ToString)
End Try
cryReport.SetDataSource(sd
CrystalReportViewer1.Repor
cryReport.Load(RepLocation
CrystalReportViewer1.Refre
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.