Solved

Cannot load Crystal Report in a web browser!!!

Posted on 2004-09-17
12
879 Views
Last Modified: 2008-01-09
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,

 
0
Comment
Question by:chris_nephew
  • 10
12 Comments
 
LVL 17

Expert Comment

by:AerosSaga
Comment Utility
0
 
LVL 17

Expert Comment

by:AerosSaga
Comment Utility
what kind of machine is it running on if its 98/me look here:

http://support.businessobjects.com/library/kbase/articles/c2011640.asp
0
 
LVL 17

Expert Comment

by:AerosSaga
Comment Utility
0
 
LVL 17

Expert Comment

by:AerosSaga
Comment Utility
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
 
LVL 17

Expert Comment

by:AerosSaga
Comment Utility
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
 
LVL 17

Expert Comment

by:AerosSaga
Comment Utility
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
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 17

Expert Comment

by:AerosSaga
Comment Utility
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
 
LVL 17

Expert Comment

by:AerosSaga
Comment Utility
well thats all I could come up with
0
 
LVL 17

Accepted Solution

by:
AerosSaga earned 250 total points
Comment Utility
0
 
LVL 18

Expert Comment

by:DotNetLover_Baan
Comment Utility
Are you alright Scott..... holy.... you got 9 out of 10 comments here ? damn... good job though...
0
 
LVL 17

Expert Comment

by:AerosSaga
Comment Utility
hehe I'm fine ;)
0
 
LVL 1

Author Comment

by:chris_nephew
Comment Utility
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

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now