hello,

i want to know that how to pass parameter in crystal report in asp.net using vb.net 2003
i want to pass parameter through drop down list control
plz help me out
thanks in advance it';s hurrry

Dani AI

Generated

For , and : the straightforward, reliable pattern in ASP.NET (VB.NET 2003) is to load the .rpt into a ReportDocument, set the parameter with ReportDocument.SetParameterValue, then set the CrystalReportViewer.ReportSource. Use the exact parameter field name you defined in the report and pass a value of the correct type. The ReportDocument.SetParameterValue API is the supported approach in CR .NET 9. (learn.microsoft.com)

Example (put this in a button click or DropDownList SelectedIndexChanged with AutoPostBack = True):

Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared

Protected Sub btnRun_Click(ByVal sender As Object, ByVal e As EventArgs)
    Dim rpt As New ReportDocument()
    rpt.Load(Server.MapPath("~/Reports/MyReport.rpt"))
    rpt.Refresh() 'help avoid the viewer prompting for parameters (see note)
    rpt.SetParameterValue("CustomerID", DropDownList1.SelectedValue)
    CrystalReportViewer1.ReportSource = rpt
End Sub

If the parameter lives in a subreport use the overload that accepts the subreport name: rpt.SetParameterValue("ParamName", value, "SubreportName"). For multi-value parameters use the ParameterFieldDefinitions / ParameterValues / ParameterDiscreteValue pattern and call ApplyCurrentValues. (learn.microsoft.com)

Notes and common pitfalls: call rpt.Refresh() after Load to reduce runtime prompting issues (seen often with CR .NET); set numeric parameters with the correct numeric type (eg Convert.ToInt32); make sure the DropDownList posts back (AutoPostBack or a submit button). Always close and dispose the ReportDocument (for example in Page_Unload or after export) and clear the viewer’s ReportSource to avoid leaks or open DB connections. (userapps.support.sap.com)

hello,

i want to know that how to pass parameter in crystal report in asp.net using vb.net 2003
i want to pass parameter through drop down list control
plz help me out
thanks in advance it';s hurrry

I need help on the same matter... could someone please help

hello,

i want to know that how to pass parameter in crystal report in asp.net using vb.net 2003
i want to pass parameter through drop down list control
plz help me out

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.