Click to See Complete Forum and Search --> : Crystal report Load Report Failed error in vs.net2003


kshama002
March 11th, 2008, 03:13 PM
Hi I m also getting same error.. details are

I am developing an application in ASP.Net Framwork V.1.1 and for reports i m using crystal reports 9.1.5000.There is no problem when i am running the applicaiton through my MS.Net IDE there is no problem.I am facing problem while depolying the application in my client's server when i m generating reports i m getting an error " Load Report Failed".

please advice me.

Any kind of help or suggestiong is appreciable.

thanx in advance

P:S

Development System Config
OS:win2003
RDBMS:Sqlserver2000
Microsoft.Net 2003
Crystal Report Version 9.1.5000(Bundled)
Using ADO.Net Dataset for report generation

Deployment System Config

OS:Win2000advance server
sqlserver2000
Frame work v 1.1


Error:

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: Load report failed.

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: Load report failed.]
.F(String  , EngineExceptionErrorID 
) +272
.B(String , Int32 ) +57
CrystalDecisions.CrystalReports.Engine.ReportDocument.Load(String reportName, OpenReportMethod openMethod, Int16 parentJob) +1186
CrystalDecisions.CrystalReports.Engine.ReportDocument.Load(String reportName) +108
OCWIP.Reports.ReportDisplay.BindData()
OCWIP.Reports.ReportDisplay.Page_Load(Object sender, EventArgs e)
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +750

******

Plz plz help me to solve this weired problem........i tried almost all solution...i dont know what to do.....if u want code then here it is ..

using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using OCWIP.Reports;
using OCWIP.businessObjects;

//namespace EOP.Payment.Reports
namespace OCWIP.Reports
{
/// <summary>Welcome@mwaa1
///
/// Summary description for Recertification__Package__Mailing__Labels.
/// </summary>
public class ReportDisplay : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Label lblHeader;
protected CrystalDecisions.Web.CrystalReportViewer CrystalReportViewer1;
protected System.Web.UI.WebControls.ImageButton Imagebutton1;
protected System.Web.UI.WebControls.ImageButton btnExportToPDF;
protected System.Web.UI.WebControls.ImageButton btnExportToExcel;
CrystalDecisions.CrystalReports.Engine.ReportDocument doc = new CrystalDecisions.CrystalReports.Engine.ReportDocument();

private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
BindData();
}


public void BindData()
{
string strServer,strDBName,strUserName,strPassword;
//Set User Name and Password of Sql Server
string[] strUserPass;
char[] arrSep = {'/'};
//EOP.Data cnRep = new EOP.Data();
OCWIP.businessObjects.DataAcess cnRep = new OCWIP.businessObjects.DataAcess();

strUserPass=cnRep.strConnect.Split(arrSep);
strUserPass = cnRep.GetSqlUserPass().Split(arrSep);
strServer = strUserPass[2].ToString();
strUserName = strUserPass[4].ToString();
strPassword = strUserPass[6].ToString();
strDBName = strUserPass[8].ToString();


//Get Parameters
string strFileName,strLabel;
strFileName = Request.QueryString["File"];
strLabel =Request.QueryString["Label"];
//Set Headder
this.lblHeader.Text =strLabel;
doc.Load(Server.MapPath("..") + "/Reports/"+ strFileName);

foreach(string var in Request.QueryString)
{
if (var!= "File" && var!= "Label")
doc.SetParameterValue(var,Request.QueryString[var]);
}

doc.SetDatabaseLogon(strUserName,strPassword);
//Load All Tables to reports
CrystalDecisions.Shared.TableLogOnInfos crtableLogoninfos = new CrystalDecisions.Shared.TableLogOnInfos();
CrystalDecisions.Shared.TableLogOnInfo crtableLogoninfo = new CrystalDecisions.Shared.TableLogOnInfo();
CrystalDecisions.Shared.ConnectionInfo crConnectionInfo = new CrystalDecisions.Shared.ConnectionInfo();
CrystalDecisions.CrystalReports.Engine.Tables CrTables;
CrystalDecisions.CrystalReports.Engine.Table CrTable;

crConnectionInfo.ServerName = strServer;
crConnectionInfo.DatabaseName = strDBName;
crConnectionInfo.UserID =strUserName;
crConnectionInfo.Password = strPassword;
CrTables = doc.Database.Tables;

if ( CrTables.Count > 0 )
{
CrTable = ( CrystalDecisions.CrystalReports.Engine.Table )CrTables.Current;
while ( CrTables.MoveNext() )
{
CrTable = ( CrystalDecisions.CrystalReports.Engine.Table )CrTables.Current;
crtableLogoninfo = CrTable.LogOnInfo;
crtableLogoninfo.ConnectionInfo = crConnectionInfo;
CrTable.ApplyLogOnInfo(crtableLogoninfo);
}
}
//Display Report in Crystal Viewer
CrystalReportViewer1.DisplayToolbar = true;
CrystalReportViewer1.ReportSource =doc;

}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}

/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.btnExportToExcel.Click += new System.Web.UI.ImageClickEventHandler(this.btnExportToExcel_Click);
this.btnExportToPDF.Click += new System.Web.UI.ImageClickEventHandler(this.btnExportToPDF_Click);
this.Load += new System.EventHandler(this.Page_Load);

}
#endregion



private void btnExportToExcel_Click(object sender, System.Web.UI.ImageClickEventArgs e)
{
string strPath;
string strFileName;
strFileName = Session.SessionID.ToString();
strPath = Server.MapPath("../") + "Reports/Export/"+ strFileName +".xls";

CrystalDecisions.Shared.DiskFileDestinationOptions DiskOpts = new CrystalDecisions.Shared.DiskFileDestinationOptions();

doc.ExportOptions.ExportDestinationType = CrystalDecisions.Shared.ExportDestinationType.DiskFile;
doc.ExportOptions.ExportFormatType = CrystalDecisions.Shared.ExportFormatType.Excel;
DiskOpts.DiskFileName = strPath;
doc.ExportOptions.DestinationOptions = DiskOpts;
doc.Export();
//Response.Redirect ("../../Certification/Reports/Export/"+ strFileName+".xls");
string str="../Reports/Export/"+ strFileName+".xls";

Response.Write("<script type='text/javascript'>" +
"open_win=window.open('" + str +
"','','top=50,left=50,toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, copyhistory=yes, width=900, height=600');open_win.focus()" +
"</script>");
}



private void btnExportToPDF_Click(object sender, System.Web.UI.ImageClickEventArgs e)
{

string strPath;
string strFileName;
strFileName = Session.SessionID.ToString();
strPath = Server.MapPath("../") + "Reports/Export/"+ strFileName +".pdf";

CrystalDecisions.Shared.DiskFileDestinationOptions DiskOpts = new CrystalDecisions.Shared.DiskFileDestinationOptions();
doc.ExportOptions.ExportDestinationType = CrystalDecisions.Shared.ExportDestinationType.DiskFile;
doc.ExportOptions.ExportFormatType = CrystalDecisions.Shared.ExportFormatType.PortableDocFormat;

DiskOpts.DiskFileName = strPath;
doc.ExportOptions.DestinationOptions = DiskOpts;
doc.Export();
//Response.Redirect ("../../Certification/Reports/Export/"+ strFileName+".pdf");
string str="../Reports/Export/"+ strFileName+".pdf";

Response.Write("<script type='text/javascript'>" +
"open_win=window.open('" + str +
"','','top=50,left=50,toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, copyhistory=yes, width=900, height=600');open_win.focus()" +
"</script>");
}

}
}

HanneSThEGreaT
March 12th, 2008, 09:50 AM
[ Moved ]

MikeVallotton
March 13th, 2008, 12:42 AM
This line is almost certainly your problem:

doc.Load(Server.MapPath("..") + "/Reports/"+ strFileName);

First, verify that this string is the rpt file that you think it is.
Second, make sure that this file exists at that file path.
Third, make sure the IIS user has permissions to access the file at that location.
Fourth, why are you storing your rpt files outside of your web application?