I am now getting the following failure message:-
Server Error in '/WebApp5' Application.
--------------------------------------------------------------------------------
Invalid report file path.
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: CrystalDecisions.CrystalReports.Engine.LoadSaveReportException: Invalid report file path.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[LoadSaveReportException: Invalid report file path.]
CrystalDecisions.Web.ReportAgent.h()
CrystalDecisions.Web.ReportAgentBase.set_ReportSource(Object value)
CrystalDecisions.Web.ReportAgent.set_ReportSource(Object value)
CrystalDecisions.Web.CrystalReportViewerBase.set_ReportSource(Object value)
WebApp5.WebForm1.Page_Load(Object sender, EventArgs e)
System.Web.UI.Control.OnLoad(EventArgs e)
System.Web.UI.Control.LoadRecursive()
System.Web.UI.Page.ProcessRequestMain()
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.1.4322.2032; ASP.NET Version:1.1.4322.2032
My code is now:-
Public
Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim
crConnectionInfo As New ConnectionInfo
Dim crConnServer As String = ConfigurationSettings.AppSettings("CrConnServer")
Dim crConnDbName As String = ConfigurationSettings.AppSettings("CrConnDbName")
Dim crConnUserId As String = ConfigurationSettings.AppSettings("CrConnUserId")
Dim crConnPassword As String = ConfigurationSettings.AppSettings("CrConnPassword")
Dim err As String
Dim objReport As New report
Dim myTable As CrystalDecisions.CrystalReports.Engine.Table
Dim MyLogonInfo As CrystalDecisions.Shared.TableLogOnInfo
Try
crConnectionInfo.ServerName = crConnServer
crConnectionInfo.DatabaseName = crConnDbName
crConnectionInfo.UserID = crConnUserId
crConnectionInfo.Password = crConnPassword
For Each myTable In crReport.Database.Tables
myTable.ApplyLogOnInfo(MyLogonInfo)
Next
crReport.Load("c:\inetpub\wwwroot\WebServ5\STDPOReport.rpt")
Catch ex As Exception
err = ex.Message
End Try
If Not objReport.ErrorMessage Is Nothing Then
Response.Write(objReport.ErrorMessage)
End If
'Export the report. SD 04/08/06.
objReport.Export(crReport, "STDPOReport", ExportFormatType.PortableDocFormat)
If Not objReport.ErrorMessage Is Nothing Then
Response.Write(objReport.ErrorMessage)
End If
'Print the report. SD 04/08/06.
objReport.PrintToPrinter(crReport, PaperOrientation.Landscape)
If Not objReport.ErrorMessage Is Nothing Then
Response.Write(objReport.ErrorMessage)
End If
CrystalReportViewer1.ReportSource = crReport
End Sub
I have checked the address of the report and have confirmed that it is
c:\inetpub\wwwroot\WebServ5\STDPOReport.rpt
In fact I cut and pasted that address.
Edited by RichardP - 04 May 2007 at 2:04am