Click here to Skip to main content
15,891,762 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
VB
Dim paramFields As New ParameterFields
Dim paramField As New ParameterField
Dim discreteVal As New ParameterDiscreteValue
Dim cno As String

'PASSING A SECOND PARAMETER (DISCRETE VALUE) ***
paramField = New ParameterField
paramField.ParameterFieldName = "@LocationID"
discreteVal = New ParameterDiscreteValue
discreteVal.Value = "CASUALTY"
paramField.CurrentValues.Add(discreteVal)
paramFields.Add(paramField)

CrystalReportViewer1.ParameterFieldInfo = paramFields

When l run above code, its giving me following error:

"The parameter is incorrect"
Posted
Updated 21-Apr-15 0:52am
v2

1 solution

Funny indeed. The above code is correct. The problem is with Access database. If the query parameter has [] then it gives this error, however if the MS Access parameter has no [], then it does not give this error message. e.g.

SELECT * FROM users WHERE username = [@username] ---Gives this error, but
SELECT * FROM users WHERE username = @username ---Prints results in report
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900