I know that this has been beaten to death but I can't seem to resolve
my issues (I have 2 of them). I have created a class that exposes a
public method which returns a datatable as a datasource for a Crystal
Report. The method has a single argument which represents a parameter
required by the Stored Procedure.
When I generate the report in Crystal and run it using the class I
built, it works fine. I've tried it with parameters and without,
both scenarios work great. Now when I try to access it from a web
application I start running into problems. By the way, I'm running
Crystal 10, IIS, SQL2000 and .Net 1.0.
I'll list my code below but basically I run into two separate
problems. I'm able to add a value to the CurrentValues collection of
the ParameterFields collection (I verify that it has been added when I
step through my code), however, when I attempt to export the report I
get the following error: "ParameterFieldCurrentValueException". So
after spending a lot of time trying to get a parameter passed over, I
decided to test the web based code by creating another report, one
without parameters.
Well this report didn't provide much help as I get the following,
different, error:
CrystalDecisions.CrystalReports.Engine.LogOnExcept ion: Logon failed.
Details: mscorlib : File or assembly name AUS.Common.Reports.dll, or
one of its dependencies, was not found. What's strange is that the
report runs fine on it's own.
Now to my code:
ReportDocument rep = new ReportDocument();
try
{
rep.Load("c:\\test\\report1.rpt");
// I've tried it both with and without this line:
rep.SetDatabaseLogon("sa","sa");
rep.SetParameterValue("customerID",Request.Form["CustomerID"]);
rep.VerifyDatabase();
'
rep.ExportToHttpResponse(ExportFormatType.Portable DocFormat,
this.Page.Response, false,"");
}
catch (Exception ex)
{
Response.Write(ex.ToString() );
}
finally
{
rep.Dispose();
}
Does anyone have any thoughts or insight as to why I have this
overwhelming urge to pull out all my hair?
Thanks,
Stephan
Complete error output:
CrystalDecisions.CrystalReports.Engine.LogOnExcept ion: Logon failed.
Details: mscorlib : File or assembly name Asset.AUS.Common.Reports.dll,
or one of its dependencies, was not found. Failed to open a rowset.
Error in File C:\WINNT\TEMP\{07FD2BF4-EA08-4D07-91F6-58E3FD792173}.rpt:
Unable to connect: incorrect log on parameters. --->
System.Runtime.InteropServices.COMException (0x8004100F): Logon failed.
Details: mscorlib : File or assembly name AUS.Common.Reports.dll, or
one of its dependencies, was not found. Failed to open a rowset. Error
in File C:\WINNT\TEMP\{07FD2BF4-EA08-4D07-91F6-58E3FD792173}.rpt:
Unable to connect: incorrect log on parameters. at
CrystalDecisions.ReportAppServer.Controllers.Repor tSourceClass.Export(ExportOptions
pExportOptions, RequestContext pRequestContext) at
CrystalDecisions.ReportSource.EromReportSourceBase .ExportToStream(ExportRequestContext
reqContext) --- End of inner exception stack trace --- at
CrystalDecisions.ReportAppServer.ConvertDotNetToEr om.ThrowDotNetException(Exception
e) at
CrystalDecisions.ReportSource.EromReportSourceBase .ExportToStream(ExportRequestContext
reqContext) at
CrystalDecisions.CrystalReports.Engine.FormatEngin e.ExportToStream(ExportRequestContext
reqContext) at
CrystalDecisions.CrystalReports.Engine.ReportDocum ent.y(ExportOptions
1) at
CrystalDecisions.CrystalReports.Engine.ReportDocum ent.ExportToHttpResponse(ExportOptions
options, HttpResponse response, Boolean asAttachment, String
attachmentName) at
CrystalDecisions.CrystalReports.Engine.ReportDocum ent.ExportToHttpResponse(ExportFormatType
formatType, HttpResponse response, Boolean asAttachment, String
attachmentName) at WebApplication3.WebForm1.test1() in
c:\inetpub\wwwroot\webapplication3\webform1.aspx.c s:line 48
CrystalDecisions.CrystalReports.Engine.ParameterFi eldCurrentValueException:
Missing parameter values. --->
System.Runtime.InteropServices.COMException (0x8004100E): Missing
parameter values. at
CrystalDecisions.ReportAppServer.Controllers.Repor tSourceClass.Export(ExportOptions
pExportOptions, RequestContext pRequestContext) at
CrystalDecisions.ReportSource.EromReportSourceBase .ExportToStream(ExportRequestContext
reqContext) --- End of inner exception stack trace --- at
CrystalDecisions.ReportAppServer.ConvertDotNetToEr om.ThrowDotNetException(Exception
e) at
CrystalDecisions.ReportSource.EromReportSourceBase .ExportToStream(ExportRequestContext
reqContext) at
CrystalDecisions.CrystalReports.Engine.FormatEngin e.ExportToStream(ExportRequestContext
reqContext) at
CrystalDecisions.CrystalReports.Engine.ReportDocum ent.y(ExportOptions
1) at
CrystalDecisions.CrystalReports.Engine.ReportDocum ent.ExportToHttpResponse(ExportOptions
options, HttpResponse response, Boolean asAttachment, String
attachmentName) at
CrystalDecisions.CrystalReports.Engine.ReportDocum ent.ExportToHttpResponse(ExportFormatType
formatType, HttpResponse response, Boolean asAttachment, String
attachmentName) at WebApplication3.WebForm1.test1() in
c:\inetpub\wwwroot\webapplication3\webform1.aspx.c s:line 48