Hi,
I think i'm doing something simple, although i may be wrong. I was able
to load a Crystal report file up until today, and even now, its only 1
report that's misbehaving. I'll confess that i didn't create the
report, it was done by our Crystal guy with Crystal 9 (or 8), all i do
is load it using .NET, which, like i said before, worked just fine.
Here's the code:
//i call this func from Page_Load passing in only the filename
//the rest is hardcoded.
public void LoadCrystalReport(string strServerName,
string strDB_Username, string strDB_Password, string
strReportFilename)
{
ReportDocument crReportDocument = new ReportDocument();
crReportDocument.Load(Server.MapPath(strReportFile name));
Database crDatabase;
Tables crTables;
TableLogOnInfo crTableLogOnInfo;
ConnectionInfo crConnectionInfo;
//Set the crConnectionInfo with values either stored in
//the report or hard coded below
crConnectionInfo =
crReportDocument.Database.Tables[0].LogOnInfo.ConnectionInfo;
crConnectionInfo.DatabaseName = "";
crConnectionInfo.ServerName = strServerName;
crConnectionInfo.UserID = strDB_Username;
crConnectionInfo.Password = strDB_Password;
//Set the CrTables object to the Tables collection of
//the Report's dDtabase
crDatabase = crReportDocument.Database;
crTables = crDatabase.Tables;
// LOOP THRU THE CRYSTAL REPORT 'TEMPLATE',
// TO GET THE LOGON INFO ETC.
for (int i = 0; i < crTables.Count; i++)
{
crTableLogOnInfo = crTables[i].LogOnInfo;
crTableLogOnInfo.ConnectionInfo = crConnectionInfo;
crTables[i].ApplyLogOnInfo(crTableLogOnInfo);
}
crReportDocument.SetParameterValue("startdate", "6/1/2005");
crReportDocument.SetParameterValue("enddate", "8/1/2005");
// this will retrieve it as a web page
this.CrystalReportViewer1.ReportSource = crReportDocument;
}
//At this point it crashes giving me
Query Engine Error:
'c:\inetpub\wwwroot\myutils\Abs_Tard_for_Certifier .rpt'
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.DataSourceE xception: Query
Engine Error: 'c:\inetpub\wwwroot\myutils\Abs_Tard_for_Certifier .rpt'
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:
[DataSourceException: Query Engine Error:
'c:\inetpub\wwwroot\myutils\Abs_Tard_for_Certifier .rpt']
.F(String , EngineExceptionErrorID
) +540
.A(Int16 , Int32 ) +537
CrystalDecisions.CrystalReports.Engine.FormatEngin e.GetPage(PageRequestContext
reqContext) +539
CrystalDecisions.ReportSource.LocalReportSourceBas e.GetPage(PageRequestContext
pageReqContext) +189
CrystalDecisions.Web.ReportAgent.u(Boolean N) +164
CrystalDecisions.Web.CrystalReportViewer.OnPreRend er(EventArgs e)
+108
System.Web.UI.Control.PreRenderRecursiveInternal() +62
System.Web.UI.Control.PreRenderRecursiveInternal() +125
System.Web.UI.Control.PreRenderRecursiveInternal() +125
System.Web.UI.Page.ProcessRequestMain() +1499
-------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.1.4322.2032;
ASP.NET Version:1.1.4322.2032
I've tried opening the report file and re-saving it as a Crystal for
VS.NET file, no difference. I checked to make sure i have the correct
Merge Modules as well as the DLLs in System32. The weird thing about
this is, the Abs_Tard_for_Certifier.rpt file is the only one that
crashes, even some previous versions of it. Other rpt files display
just fine.
If anyone can help, I'd really appreciate it.
Thanks.
Regards,
Rafael Zavulunov