passing parameter issue in crystalreport
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:
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
and code i am using is:
Code:
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()
please help me in this issue
Re: passing parameter issue in crystalreport
take a look at this thread that was resolved previously:
http://www.vbforums.com/showthread.php?t=524736
Re: passing parameter issue in crystalreport
but this example is about to passing parameter to sub reports but in my case i m not using any subreport....
Re: passing parameter issue in crystalreport
post #7 of that link shows how to pass a parameter to a report.