问题描述
大家好
我收到了水晶报告,并想通过VB.Net查看它。
我的报告有一个参数(商店程序中的参数)我想要来自vb.net的输入参数。它是这样的错误:索引无效。 (来自HRESULT的异常:0x8002000B(DISP_E_BADINDEX))
这是模块中的代码:
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")
注意:
我使用Crystal Report ActiveX控件查看报告。
请帮我解决一下如何输入参数到Crystal Report ActiveX的错误,如上所示?
谢谢
TONY
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
推荐答案
这篇关于错误将报告加载到.net中的Crystal Report Activex Viewer的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!