加载报告时我的asp.net报告出现问题 [英] problem on my asp.net report at the time of load the report
本文介绍了加载报告时我的asp.net报告出现问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好,
当我将项目放在远程站点时,它显示错误,并且错误是:-
Hello,
When I put my project in remote site it is showing error and the error is:-
CrystalDecisions.Shared.CrystalReportsException: Load report failed. ---> System.Runtime.InteropServices.COMException: Invalid file name. at CrystalDecisions.ReportAppServer.ClientDoc.ReportClientDocumentClass.Open(Object& DocumentPath, Int32 Options) at CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.Open(Object& DocumentPath, Int32 Options) at CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.EnsureDocumentIsOpened() --- End of inner exception stack trace --- at CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.EnsureDocumentIsOpened() at CrystalDecisions.CrystalReports.Engine.ReportDocument.Load(String filename, OpenReportMethod openMethod, Int16 parentJob) at CrystalDecisions.CrystalReports.Engine.ReportDocument.Load(String filename) at Crystal_Report_CommonReport.Show_Data
加载(字符串文件名).
我为加载报告编写的代码是:-
The code which I have written for load the report is :-
ReportDocument boReportDocument = new ReportDocument();
boReportDocument.Load(Server.MapPath("RptCustomerDeposits.rpt"));
还有其他加载报告的过程,或者我将做哪些更改?
请帮帮我.
在此先感谢.
Is there any other process to load the report or what the changes I will Do?
Please help me.
Thanks in Advance.
推荐答案
尝试此技巧/窍门
Crystal Reports:修复了"Load report failed"错误. [ ^ ]
Try this Tip/Trick
Crystal Reports: Fix for "Load report failed" error.[^]
如果有帮助,请参阅此示例...
Hi,
See this sample if could help...
private void AddParameter(ReportDocument reportDocument, string value, string parameterName)
{
ParameterFieldDefinitions prmDef = reportDocument.DataDefinition.ParameterFields;
ParameterValues prmVal = new ParameterValues();
ParameterDiscreteValue prmDiscreteVal = new ParameterDiscreteValue();
prmDiscreteVal.Value = value;
prmVal.Add(prmDiscreteVal);
ParameterFieldDefinition prmFD = prmDef[parameterName];
try
{
prmFD.ApplyCurrentValues(prmVal);
prmFD.ApplyDefaultValues(prmVal);
}
catch (Exception)
{
Response.Redirect("~\\Login.aspx");
}
}
protected void Page_Load(object sender, EventArgs e)
{
ReportDocument crpt = new ReportDocument();
string rptLoc = String.Empty;
//DataSet1 ds = new DataSet1(); // Had already created a Dataset?
CrystalReportViewer1.ReportSourceID = "CrystalReportSource1";
CrystalReportSource1.Report.FileName =
Server.MapPath("") + "\\Reports\\RptCustomerDeposits.rpt";
rptLoc = CrystalReportSource1.Report.FileName;
crpt.Load(rptLoc);
crpt.SetDataSource(ds);
AddParameter(crpt, "12345678", "CardNumber"); // Sample to call AddParameter
CrystalReportViewer1.ReportSource = crpt;
}
问候
Regards,
这篇关于加载报告时我的asp.net报告出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文