Quantcast
Channel: Crystal Reports
Viewing all articles
Browse latest Browse all 1507

Open the crystal report in PDF on button click

$
0
0

Hello,
Generating report through passing parameter to Crystal Report,i need to open the report in PDF in new window on button click, i tried the following code
getting "Missing Parameter" Error
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
sysMonthRpt = New ReportDocument
sysMonthRpt.Load(Server.MapPath("SystemStatus.rpt"))
sysMonthRpt.SetDatabaseLogon("sa", "", "myServer", "myDB")
CrystalReportViewer1.ReportSource = sysMonthRpt
Dim myParams As New ParameterFields
Dim myparam As New ParameterField
Dim myDiscretevalue As New ParameterDiscreteValue
myparam.ParameterFieldName = "@tkMonth"
myDiscretevalue.Value = "12"
myparam.CurrentValues.Add(myDiscretevalue)
myParams.Add(myparam)
CrystalReportViewer1.ParameterFieldInfo = myParams
Dim oStream As MemoryStream
' using System.IO
oStream = DirectCast(sysMonthRpt.ExportToStream(CrystalDecisions.[Shared].ExportFormatType.PortableDocFormat), MemoryStream)
Response.Clear()
Response.Buffer = True
Response.ContentType = "application/pdf"
Response.BinaryWrite(oStream.ToArray())
Response.[End]()
End Sub
Any solution plz..
Thanks


Viewing all articles
Browse latest Browse all 1507

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>