страница aspx
<asp:Button ID="btnPDF" runat="server" Text="PDF Format" onclick="btnPDF_Click" />
<CR:CrystalReportViewer ID="CrystalReportViewer1" runat="server" AutoDataBind="true" />
страница aspx.vb
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
Dim Report As ReportDocument = New ReportDocument()
Report.Load(Server.MapPath("~/CrystalReport.rpt"))
Report.SetDatabaseLogon("sa", "######", "IT250WS", "demo")
CrystalReportViewer1.ReportSource = Report
End Sub
Protected Sub btnPDF_Click(ByVal sender As Object, ByVal e As EventArgs)
Dim Report As ReportDocument = New ReportDocument()
Report.Load(Server.MapPath("~/CrystalReport.rpt"))
Report.SetParameterValue("@EmpId", 1)
Report.SetDatabaseLogon("sa", "######", "IT250WS", "demo")
Response.Buffer = False
Response.ClearContent()
Response.ClearHeaders()
Report.ExportToHttpResponse(ExportFormatType.PortableDocFormat, Response, True, "File_Name")
Response.[End]()
End Sub
Ошибка получения:
Неверный индекс. (Исключение из HRESULT: 0x8002000B (DISP_E_BADINDEX))
Сведения об исключении: System.Runtime.InteropServices.COMException: недопустимый индекс. (Исключение из HRESULT: 0x8002000B (DISP_E_BADINDEX))