Hi, i am biggener to VB.NET and ADO.NET. I have created a VB.NET form contains "Date From" and "Date To". i want to pass these two range parameters to crystal reports to manipulate the result. What is the way to do so using ADO.NET. Kindly some one explain Step by Step. Thanks in Advance

Dim crParameterFieldDefinitions As ParameterFieldDefinitions
        Dim crParameterFieldDefinition As ParameterFieldDefinition
        Dim crParameterValues As New ParameterValues
        Dim crParameterDiscreteValue As New ParameterDiscreteValue

        crParameterDiscreteValue.Value = TextBox1.Text
        crParameterFieldDefinitions =  _
			cryRpt.DataDefinition.ParameterFields
        crParameterFieldDefinition =  _
			crParameterFieldDefinitions.Item("Orderdate")
        crParameterValues = crParameterFieldDefinition.CurrentValues

        crParameterValues.Clear()
        crParameterValues.Add(crParameterDiscreteValue)
        crParameterFieldDefinition.ApplyCurrentValues(crParameterValues)

if want to know more detail about this check this link.

http://vb.net-informations.com/crystal-report/vb.net_crystal_report_parameter_date.htm

bruce

hi bro,
I have gone thru it and it seems to b a lil help to me.,and btw,my actual requirement is i have to add a new filed "Total cost" in crystal report which is not a field in DB,its a dynamic variable which shld get reflected in the report..,Help please..,
many thanks..

i tried that code and it works fine. i hope you can help me with my problem,same code above but the crParameterDiscreteValue.Value must come from my datagridview or my datatable.i already set sql connection but it loads only my report.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.