rpc86
Jun 18th, 2008, 11:42 PM
Hi guys,
I'm trying to load a report on crystal based on the Stored Procedure I created in MSSQL Server 2000. I created new connection from Crystal Report then I selected the stored procedure name. There is only 1 parameter on it.
My problem is when I run the report, it says "pr_Product_Report" expects parameter "supplierID". I'm not sure if the way I supplied the value of parameter below is correct. I'm just guessing if the code below is right, or you can advice me something that will work fine.
Public Sub ProductReport(ByVal iSuppID As Integer)
Dim crLogOn As New CrystalDecisions.Shared.TableLogOnInfo
Dim ServerName As String = ""
Dim DBName As String = ""
Dim Val1 As New ParameterDiscreteValue()
Dim rpt As New CrystalReport1
Dim Field1 As New ParameterField
Val1.Value = iSuppID
Field1.CurrentValues.Add(Val1)
crLogOn.ConnectionInfo.IntegratedSecurity = True
crLogOn.ConnectionInfo.ServerName = "myServer"
crLogOn.ConnectionInfo.DatabaseName = "Northwind"
rpt.Database.Tables(0).ApplyLogOnInfo(crLogOn)
Form2.CrystalReportViewer1.Visible = True
Form2.CrystalReportViewer1.ReportSource = rpt
Form2.Show()
End Sub
Please help. I'm new in Vb.Net
I'm trying to load a report on crystal based on the Stored Procedure I created in MSSQL Server 2000. I created new connection from Crystal Report then I selected the stored procedure name. There is only 1 parameter on it.
My problem is when I run the report, it says "pr_Product_Report" expects parameter "supplierID". I'm not sure if the way I supplied the value of parameter below is correct. I'm just guessing if the code below is right, or you can advice me something that will work fine.
Public Sub ProductReport(ByVal iSuppID As Integer)
Dim crLogOn As New CrystalDecisions.Shared.TableLogOnInfo
Dim ServerName As String = ""
Dim DBName As String = ""
Dim Val1 As New ParameterDiscreteValue()
Dim rpt As New CrystalReport1
Dim Field1 As New ParameterField
Val1.Value = iSuppID
Field1.CurrentValues.Add(Val1)
crLogOn.ConnectionInfo.IntegratedSecurity = True
crLogOn.ConnectionInfo.ServerName = "myServer"
crLogOn.ConnectionInfo.DatabaseName = "Northwind"
rpt.Database.Tables(0).ApplyLogOnInfo(crLogOn)
Form2.CrystalReportViewer1.Visible = True
Form2.CrystalReportViewer1.ReportSource = rpt
Form2.Show()
End Sub
Please help. I'm new in Vb.Net