Solved

Cannot load Crystal Report in a web browser!!!

Posted on 2004-09-17
12
904 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 10
12 Comments
 
LVL 17

Expert Comment

by:AerosSaga
ID: 12087752
0
 
LVL 17

Expert Comment

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

http://support.businessobjects.com/library/kbase/articles/c2011640.asp
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 17

Expert Comment

by:AerosSaga
ID: 12087797
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
ID: 12087812
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
ID: 12087826
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
 
LVL 17

Expert Comment

by:AerosSaga
ID: 12087829
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
ID: 12087833
well thats all I could come up with
0
 
LVL 17

Accepted Solution

by:
AerosSaga earned 250 total points
ID: 12087878
0
 
LVL 18

Expert Comment

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

Expert Comment

by:AerosSaga
ID: 12089698
hehe I'm fine ;)
0
 
LVL 1

Author Comment

by:chris_nephew
ID: 12127177
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…

695 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