I have been trying to solve passing parameters in Crystal Reports.
What I have done is :
- I added Crystal Reports to my project,
- I connect to database using OLE DB (ADO) in database expert form (for your kind information; I did not create or add
DataSet1.xsd
file the Crystal Reports worked on below code with out parameters and I want report with parameter) - 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, Can anyone tell me that Am I missing something strange ? If yes please guide me
Here is images Links : Dropbox - Creport error
First Image shows my crystal report look, second image shows my DB connection and third one shows the error which I am getting while executing below code
Please help me, I've been trying to solve this problem for two months.
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
PublicClass frmrptProducts
PrivateSub frmrptProducts_Load(ByVal sender As System.Object,ByVal e As System.EventArgs)HandlesMyBase.Load
Dim cryRpt AsNew ReportDocument
Dim CrTables As Tables
Dim crtableLogoninfo AsNew TableLogOnInfo
Dim crConnectionInfo AsNew ConnectionInfo
'load report
cryRpt.Load(ReportPath &"CRproducts.rpt")
'parameters definition(if any) This is the part where I pass parameters
Dim ColourName AsString="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 =""
EndWith
CrTables = cryRpt.Database.Tables
ForEach CrTable In CrTables
crtableLogoninfo = CrTable.LogOnInfo
crtableLogoninfo.ConnectionInfo = crConnectionInfo
CrTable.ApplyLogOnInfo(crtableLogoninfo)
Next
CRV.ReportSource = cryRpt
CRV.Refresh()
EndSub