Click here to Skip to main content
15,884,388 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
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
Posted

1 solution

do you have the solution for this question now
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900