Here i have mentioned just example. just look in to that. so that you can know how to pass the parameter to crystal report.
**********************************************
' Declare variables needed to pass the parameters
' to the viewer control.
Dim paramFields As New ParameterFields()
Dim paramField As New ParameterField()
Dim discreteVal As New ParameterDiscreteValue()
Dim rangeVal As New ParameterRangeValue()
' The first parameter is a discrete parameter with multiple values.
' Set the name of the parameter field, this must match a
' parameter in the report.
paramField.ParameterFieldName = "au_lname"
' Set the first discrete value and pass it to the parameter
discreteVal.Value = "Dull"
paramField.CurrentValues.Add(discreteVal)
' Set the second discrete value and pass it to the parameter.
' The discreteVal variable is set to new so the previous settings
' will not be overwritten.
discreteVal = New ParameterDiscreteValue()
discreteVal.Value = "kannan"
paramField.CurrentValues.Add(discreteVal)
' Add the parameter to the parameter fields collection.
paramFields.Add(paramField)
' The second parameter is a range value. The paramField variable
' is set to new so the previous settings will not be overwritten.
paramField = New ParameterField()
' Set the name of the parameter field, this must match a
' parameter in the report.
paramField.ParameterFieldName = "ZIP"
' Set the start and end values of the range and pass it to the 'parameter.
rangeVal.StartValue = 1
rangeVal.EndValue = 94618
paramField.CurrentValues.Add(rangeVal)
' Add the second parameter to the parameter fields collection.
paramFields.Add(paramField)
' Set the parameter fields collection into the viewer control.
CrystalReportViewer1.ParameterFieldInfo = paramFields
CrystalReportViewer1.ReportSource = "C:\Documents and Settings\Administrator\My Documents\Visual Studio Projects\WindowsApplication1\CrystalReport1.rpt"
*************************************************
you have to use namespace of Imports CrystalDecisions.Shared
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.