"Load Report Failed." - Cannot get report to display in Crystal Report Viewer

Hi Everyone,

I have developed a report in VS2005 (On a Vista PC, in case that's relevant).

In the report designer, I switch to "Main Report Preview" and the report shows up fine - it get the data from the database and displays perfectly.

I tried to add a page to display the report in my app.  I added a crystal report viewer and a Crystal Report Source.  The report displays fine in design view.  However, when I run the app, all I get is "Load Report Failed".

Please see the code below:

<%@ Page Language="C#" MasterPageFile="~/secure.master" AutoEventWireup="true" CodeFile="reportviewer.aspx.cs" Inherits="secure_reportviewer" Title="Untitled Page" %>

<%@ Register Assembly="CrystalDecisions.Web, Version=10.2.3600.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"

Namespace="CrystalDecisions.Web" TagPrefix="CR" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">

<h1>Report Viewer</h1>

<CR:CrystalReportViewer ID="CrystalReportViewer1" runat="server" AutoDataBind="True"

HasCrystalLogo="False" Height="50px" ReportSourceID="CrystalReportSource1" Width="898px" DisplayGroupTree="False" />

<CR:CrystalReportSource ID="CrystalReportSource1" runat="server" >

<Report FileName="c:\inetpub\wwwroot\smart\secure\reports\storesummary.rpt">

</Report>

</CR:CrystalReportSource>

</asp:Content>

I have tried every combination I can think of for the report file name:

storesummary.rpt, ~/secure/reports/storesummary.rpt, c:\intetpub\wwwroot etc but nothing works.  Does ANYONE know how I can get this report to display on an ASP.NET page?!?!

Any help would be gratefully appreciated!

Thanks

Ally

0
allythacker
1/23/2008 11:59:05 AM
📁 asp.net.crystal-reports
📃 7043 articles.
⭐ 0 followers.

💬 4 Replies
👁️‍🗨️ 4301 Views

Please check if you have loaded the report in your code behind. Such as the following code:

        ReportDocument report = new ReportDocument();
        string reportPath = Server.MapPath("report.rpt");
        report.Load(reportPath);
        CrystalReportViewer1.ReportSource = report;

You have to load the report before you can view it in the aspx page. If the problem is not solved please post your entire code.

If my post helped you please remember to MARK AS ANSWER 

Sreekanth Reddy .L

0
SreekanthReddy
1/23/2008 3:54:59 PM

Thanks Sreekanth.

When I run this, I am missing a reference - should I have a "using...." in my C# code?

0
allythacker
1/23/2008 4:14:09 PM

Yes U have to Use the following namespaces:

CrystalDecisions.CrystalReports.Engine;

CrystalDecisions.Shared; 

Sreekanth. 

0
SreekanthReddy
1/25/2008 2:51:03 PM

SreekanthReddy:

Yes U have to Use the following namespaces:

CrystalDecisions.CrystalReports.Engine;

CrystalDecisions.Shared; 

Sreekanth. 

I am having the same problem.  And I've checked and am including both namespaces that you mentioned.  What else could be the problem?


Doctor Who
0
DoctorWho
3/26/2008 5:14:16 PM
Reply: