Quantcast
Channel: SCN : Discussion List - SAP Crystal Reports, version for Visual Studio
Viewing all articles
Browse latest Browse all 3636

Getting Error in Crystal report While passing parameters (DB: MS ACCESS)

$
0
0

I have been trying to solve passing parameters in Crystal Reports.

What I have done is :

  1. I added Crystal Reports to my project,
  2. 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)
  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, 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


Viewing all articles
Browse latest Browse all 3636

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>