Cannot load Crystal Report in a web browser!!!

Hi,

I'm building a web application where I want to preview or print a crystal report.  I always have the same error message : CrystalDecisions.CrystalReports.Engine.LoadSaveReportException: Load report failed.
Here is the code :
Dim r As New CrystalDecisions.CrystalReports.Engine.ReportDocument()
If IO.File.Exists("C:\Crystal\CRNET\vbnet_web_SimplePreviewReport\PO_En_client.rpt") Then
IO.File.Copy "C:\Crystal\CRNET\vbnet_web_SimplePreviewReport\PO_En_client.rpt", "C:\TEMP\PO_En_client.rpt", True)
r.Load("C:\TEMP\PO_En_client.rpt")
End If
It copy the report but it does'nt load it!!!

Here is the stack :

[LoadSaveReportException: Load report failed.]
   .K(String 
, EngineExceptionErrorID  ) +258
   .G(String , Int32 ) +57
   CrystalDecisions.CrystalReports.Engine.ReportDocument.0(String w, OpenReportMethod x, Int16 y) +868
   CrystalDecisions.CrystalReports.Engine.ReportDocument.Load(String reportName) +113
   vbnet_web_SimplePreviewReport.WebForm2.Page_Load(Object sender, EventArgs e) in c:\inetpub\wwwroot\CRNETSamples\vbnet_web_SimplePreviewReport\WebForm2.aspx.vb:33
   System.Web.UI.Control.OnLoad(EventArgs e) +67
   System.Web.UI.Control.LoadRecursive() +35
   System.Web.UI.Page.ProcessRequestMain() +750

A good help will be very appreciated

thanks,

 
LVL 1
chris_nephewAsked:
Who is Participating?
 
AerosSagaCommented:
what kind of machine is it running on if its 98/me look here:

http://support.businessobjects.com/library/kbase/articles/c2011640.asp
0
Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

 
AerosSagaCommented:
I have solved the "Load Report Failed" for my application. I am going to post solution here in case it will help solve issues for some.

The ReportSource property in the property sheet of the report should not be used. It stores the complete path even in the deployed
application. Not as you would expect. Logically this should be a developer IDE location and be resolved in the distributable, not
hard coded in the app, but that is how they did it. Here is a small snippet of code from my form that I place in the Windows generated
code after the InitializeComonent() including my logon code. My report is set to a Build Action of embedded.

In the General Declarations add the following

'Required CR assemblies
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared


At top of the form class add the following after the Inherits :

'CR Variables
    Dim crReportDocument As AuditDailyChangesToNameReport
    Dim crDatabase As Database
    Dim crTables As Tables
    Dim crTable As Table
    Dim crTableLogOnInfo As TableLogOnInfo
    Dim crConnectionInfo As ConnectionInfo


After the InitializeComponent() add the following :

        'Create an instance of the strongly-typed report object
        crReportDocument = New MyReportName

        'Setup the connection information structure to be used
        'to log onto the datasource for the report.
        crConnectionInfo = New ConnectionInfo
        With crConnectionInfo
            .ServerName = "MYSERVER" 'physical server name
            .DatabaseName = "MYDATABASE"
            .UserID = "USERID"
            .Password = "PW"
        End With

        'Get the table information from the report
        crDatabase = crReportDocument.Database
        crTables = crDatabase.Tables

        'Loop through all tables in the report and apply the connection
        'information for each table.
        For Each crTable In crTables
            crTableLogOnInfo = crTable.LogOnInfo
            crTableLogOnInfo.ConnectionInfo = crConnectionInfo
            crTable.ApplyLogOnInfo(crTableLogOnInfo)
        Next

        Me.CrystalReportViewer1.ReportSource = crReportDocument


    End Sub


Hope this is helpful.
0
 
AerosSagaCommented:
After a few days of hair pulling, I figured out why I was getting the following error on Windows Server 2003:

LoadSaveReportException: Load report failed

When Crystal Report files are compiled as embedded in the primary output files (always?), a temporary .rpt file is created in the C:\Windows\Temp\ folder. This folder is then used as the source of the report to be created / exported. The Network Service account under Windows Server 2003 does not have Read access to this directory folder by default (at least on my install!). I gave read access to the folder and am now, finally, able to create and export reports again.

It's always the little things they forget to tell you.

Cheers.
0
 
AerosSagaCommented:
I had this same problem, and resolved it.

You need to get the registration number from Crystal...you can request it at their site, or you can look in the Help->About Development Environment in .Net. You will see Crystal Reports listed with a long string of numbers and letters next to it...that is the reg number you want.

Select Crystal_regwiz2003.msm and look in the properties window in the dev environment. Expand "MergeModuleProperties" and paste that reg number in it. THIS IS REQUIRED OR YOU WILL ALWAYS GET THAT ERROR IN DISTRIBUTION.

You will also need to include a the other Crystal Reports msm's located in the c:\Program Files\Common Files\Merge Modules
Not easy or well documented...
0
 
AerosSagaCommented:
In the Solution Explorer, right click on the setup project.Add>Merge Module>Add Database_Access.msm, Database_Access_enu.msm, managed.msm, regwiz.msm, VC_CRT.msm, VC_STL.msm. 6 merge modules altogether. But make sure u have registered the Crystal Report.
0
 
AerosSagaCommented:
well thats all I could come up with
0
 
DotNetLover_BaanCommented:
Are you alright Scott..... holy.... you got 9 out of 10 comments here ? damn... good job though...
0
 
AerosSagaCommented:
hehe I'm fine ;)
0
 
chris_nephewAuthor Commented:
I'm still not able to open a report in a web form.  Does it have something to do with my Crystal Report Version 8.0.???  Because I can't open any report at all even if i'm just using a ReportDocument and a CrystalReportViewer with the databind action!!!!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.