Crystal Report: Passing url parameter value to Report

I want to pass parameter value to crystal report through url like
reports.aspx?pid=55


Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
       
        Dim theReport As New CrystalDecisions.CrystalReports.Engine.ReportDocument
        theReport.FileName = "C:\inetpub\wwwroot\prims\reports\training.rpt"
        'theReport.SetDatabaseLogon(PCON.APP.UserName, PCON.APP.Pass, PCON.APP.db_Server, PCON.APP.dbName)


        'Set the required parameter for Crystal Report
        theReport.SetParameterValue("pid", Request.Params("pid"))


        'Now, present report in PDF format
        ' theReport.ExportToHttpResponse(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, Response, False, "ExportedReport")
        CrystalReportViewer1.ReportSource = theReport


    End Sub


rpt file is having a parameter value pid . If you dont pass pid in url then it will prompt for value as usual...

Comments

Popular Posts