Vb.net 试图将参数传递给Crystal Reports
我正在尝试使用VB.net将参数从Visual Studio传递到Crystal报表 我正在使用以下代码:Vb.net 试图将参数传递给Crystal Reports,vb.net,visual-studio-2005,crystal-reports,Vb.net,Visual Studio 2005,Crystal Reports,我正在尝试使用VB.net将参数从Visual Studio传递到Crystal报表 我正在使用以下代码: Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click If IsDate(MaskedTextBox1.Text) Then Dim report As New invoice4 repo
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If IsDate(MaskedTextBox1.Text) Then
Dim report As New invoice4
report.SetParameterValue(0, gCustId)
report.SetParameterValue("CustID", gCustId)
report.SetParameterValue("inputDate", MaskedTextBox1.Text)
Try
report.DataSourceConnections.Item(0).SetConnection("", "" & My.Settings.storeCS, False)
Catch ex As Exception
MsgBox(ex.Message)
End Try
gReport = ""
With removenotice
.CrystalReportViewer1.ReportSource = report
.ShowDialog()
End With
Else
MsgBox("Please Enter a Valid Date")
End If
End Sub
但每次我运行时,它都会提示我:
Pm-?客户ID
输入后,会给我一个字段,而不是“无”
因此,我尝试替换第一个参数值:
report.SetParameterValue0,gCustId
具有
report.SetParameterValuePm-?CustID,gCustId
然后它给了我一个错误:
对链接参数的操作非法
如果我点击OK,它仍然提示我输入CustID和inputDate,并最终给出正确的报告
有什么建议吗
谢谢您确定已将其正确链接到子报告吗?我得到的印象是,它与将参数向下传递到子报表有关
您是否尝试在没有以下行的情况下运行报告:report.SetParameterValue0,gCustId?它会提示我回答输入名称为Pm-?CustID的输入。您是正确的,这与将参数向下传递到子报告有关,但我看不出我对该报告所做的操作与我创建的任何其他报告有什么不同。。。。