导出.rpt到ASP.NET中的PDF,其中带有.rpt中的参数



我需要创建一个程序以导出.rpt为pdf。我正在使用.RPT中的参数,因为我正在使用SQL存储过程来创建报告。

我正在使用VB的ASP.NET开发。

问候。

我解决了我的问题。

这是代码,因为如果需要。

问候。

    Dim PathFile As String = "c:Documents" & "Reporte.pdf"
    formatType = ExportFormatType.PortableDocFormat
    Dim oConexInfo As New CrystalDecisions.Shared.TableLogOnInfo
    oConexInfo.ConnectionInfo.ServerName = "SERVER"
    oConexInfo.ConnectionInfo.DatabaseName = "DBNAME"
    oConexInfo.ConnectionInfo.UserID = "USERID"
    oConexInfo.ConnectionInfo.Password = "PASSWORD"
    rpt.Load(Server.MapPath("~/Imprime.rpt"))
    rpt.SetParameterValue(0, Val(txt_No_Quotation.Text))   ' I send a parameter value
    rpt.Database.Tables(0).ApplyLogOnInfo(oConexInfo)      ' Here I send the credentials for conection to SQL Server with crystal reports
    CrystalReportViewer1.ReportSource = rpt
    ConfigureCRTSTALREPORT()
    rpt.ExportToDisk(formatType, PathFile)     ' Here I export the pdf to disk (in server side)

最新更新