hi all
I got crystal report and want to view it by using VB.Net.
My report has one parameter( parameter in store procedure) and i want input parameter from vb.net.It is error like that:
Invalid index. (Exception from HRESULT: 0x8002000B (DISP_E_BADINDEX))
Here is my code in module:
Public Sub PrintUnicode(ByVal crw As AxCrystalActiveXReportViewer, ByVal PathFileName As String, ByVal ParamArray data() As String)
Try
Dim j As Integer = 0
Application.UseWaitCursor = True
Dim rpa As New CRAXDDRT.Application
Dim rp As CRAXDDRT.Report
Dim crPara As New CRAXDDRT.ParameterValues
rp = rpa.OpenReport(PathFileName)
rp.Database.Tables(1).SetLogOnInfo("Server1", "DB1", "sa", "123456")
For i As Integer = 0 To UBound(data)
rp.ParameterFields(j).AddCurrentValue(data(i))
Next
crw.ReportSource = rp
crw.ViewReport()
frmPreview.ShowDialog()
Application.UseWaitCursor = False
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
Here is my Store Procedure:
alter proc WS_BP_List
@CardType varchar(2)
as
select* from ocrd
where cardtype=@cardtype
Here is my call function:
PrintUnicode(frmPreview.AxCrystalActiveXReportViewer1, RName, "@CardType", "C")
Note:
I use Crystal Report ActiveX Control to view the report.
Please help me about how to input parameter to Crystal Report ActiveX with error like above?
Thanks
TONY