Data Connectivity
 Crystal Reports Forum : Crystal Reports .NET 2003 : Data Connectivity
Message Icon Topic: Running Crystal Reports in a batch service Post Reply Post New Topic
<< Prev Page  of 2
Author Message
RichardP
Newbie
Newbie


Joined: 26 Apr 2007
Location: United Kingdom
Online Status: Offline
Posts: 9
Quote RichardP Replybullet Posted: 02 May 2007 at 9:15am
Hi Hilfy,
 
Yes, the .rpt definitely exists.
 
As for the code which you say is not needed, I can comment it out.
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3701
Quote hilfy Replybullet Posted: 02 May 2007 at 9:27am
Do you ever create the report object prior to trying to load a report into it?
 
-Dell 
IP IP Logged
RichardP
Newbie
Newbie


Joined: 26 Apr 2007
Location: United Kingdom
Online Status: Offline
Posts: 9
Quote RichardP Replybullet Posted: 03 May 2007 at 2:42am
Thanks again, Hilfy.
 
I think I see what you're getting at (after having re-read Ch. 15 of "Crystal Report .NET Programming" and looked at the code that prints a report on my on-line project where the user clicks a button).
 
I'll let you know how I get on.
 
Thanks!
IP IP Logged
RichardP
Newbie
Newbie


Joined: 26 Apr 2007
Location: United Kingdom
Online Status: Offline
Posts: 9
Quote RichardP Replybullet Posted: 04 May 2007 at 1:56am
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.
 
 
So any ideas anybody?


Edited by RichardP - 04 May 2007 at 2:04am
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3701
Quote hilfy Replybullet Posted: 04 May 2007 at 11:41am
When you're loading a file in a website, you can't use dpecific drive paths - you have to use a path relative to the website.  So, in this case, you would use (I think...):
 
crReport.Load("..\WebServ5\STDPOReport.rpt")
 
You need to figure out where the report is relative to your WebApp5 application inside IIS
 
-Dell

IP IP Logged
RichardP
Newbie
Newbie


Joined: 26 Apr 2007
Location: United Kingdom
Online Status: Offline
Posts: 9
Quote RichardP Replybullet Posted: 08 May 2007 at 2:59am
Thanks, Hilfy. I'll try and figure this out.
IP IP Logged
<< Prev Page  of 2
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.047 seconds.