passing parameter issue in crystal report when exporting to pdf

atifarif

New member
Joined
Jul 3, 2008
Messages
1
Hi 2 All,

i am export crystal report to pdf and it is working fine but it give me error whenever i pass the parameter at runtime.

Error:

Code:

Code:
[B]Missing parameter values.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Runtime.InteropServices.COMException: Missing parameter values.

Source Error:

Line 29:         CrystalReportViewer1.ParameterFieldInfo = pram2
Line 30: 
Line 31:         report.ExportToStream(ExportFormatType.PortableDocFormat)
Line 32: 
Line 33:         Dim m As System.IO.MemoryStream[/B]

and code i am using is:

Code:

Code:
[B]Dim pram1 As New ParameterField
        Dim pram2 As New ParameterFields
        Dim pramval As New ParameterDiscreteValue
        Dim report As New ReportDocument

        pram1.ParameterFieldName = "ProjectID"
        pramval.Value = 44 Request.QueryString("rpid")
        pram1.CurrentValues.Add(pramval)
        pram2.Add(pram1)          report.Load(Server.MapPath("ProjectTasks.rpt"))
        report.SetDatabaseLogon("aqeel", "aqeel")
        CrystalReportViewer1.ParameterFieldInfo.Add(pram1)
        report.ExportToStream(ExportFormatType.PortableDocFormat)

        Dim m As System.IO.MemoryStream
        m = report.ExportToStream(ExportFormatType.PortableDocFormat)
        report.Close()
        Response.ClearContent()
        Response.ClearHeaders()
        Response.ContentType = "Application/pdf"
        Response.Buffer = True
        Response.BinaryWrite(m.ToArray())
        Response.End()[/B]
 
Back
Top