在VB.NET中传递水晶报表中的参数时出错 [英] Getting error while passing parameter in crystal report in VB.NET
问题描述
大家好
我一直在尝试解决Cyrstal报告中的传递参数,
我所做的是:
1)我在我的项目中添加了cyrstal repot,
2)我使用OLE DB(ADO)在数据库专家表单连接数据库(为了您的类型信息;我没有创建或添加DataSet1.xsd文件,cyrstal报告在下面的代码中使用了out参数,我想要带参数的报告)
3)我在下面添加了一段代码我的表单加载事件
当我尝试使用.SetparameterValue函数传递参数时,报告弹出一堆值但是它不会过滤我想要的价值
这里有帮助图片
>
错误图片
水晶报告外观
DB Connecion
请帮助我,我一直试图解决这个问题2个月
Hi All
I have been trying to solve passing parameters in Cyrstal report,
What I have done is :
1) I added cyrstal repot in my project,
2) I connect with database using OLE DB (ADO) in database Expert form (For your kind information; I did not create or add DataSet1.xsd file the cyrstal report worked on below code with out parameters and I want report with parameter)
3) I added below piece of code on my form load event
When I try to pass parameter using .SetparameterValue Function, report pop up with bunch of values BUT it does not filter with values which I want
Here is helping images
Error Image
Crystal report look
DB Connecion
PLEASE HELP ME, I HAVE BEEN TRYING TO SOLVE THIS CODE SINCE 2 MONTHS
Public Class frmrptProducts
Private Sub frmrptProducts_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim cryRpt As New ReportDocument
Dim CrTables As Tables
Dim crtableLogoninfo As New TableLogOnInfo
Dim crConnectionInfo As New ConnectionInfo
'Try
'load report
cryRpt.Load(ReportPath & "CRproducts.rpt")
'parameters definition(if any)
Dim ColourName As String = "White"
cryRpt.SetParameterValue("colours", ColourName)
'provide connection info. This is important and you can change it as per your db location
With crConnectionInfo
.ServerName = My.Application.Info.DirectoryPath.ToString() & "\data\db.mdb"
'.DatabaseName = ""
'.UserID = ""
.Password = ""
End With
CrTables = cryRpt.Database.Tables
For Each CrTable In CrTables
crtableLogoninfo = CrTable.LogOnInfo
crtableLogoninfo.ConnectionInfo = crConnectionInfo
CrTable.ApplyLogOnInfo(crtableLogoninfo)
Next
CRV.ReportSource = cryRpt
CRV.Refresh()
'Catch ex As Exception
' MsgBox(ex.Message)
'End Try
End Sub
推荐答案
这篇关于在VB.NET中传递水晶报表中的参数时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!