Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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:

 

[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:

 

[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]

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...