加载水晶报告时出现问题 [英] Problem on loading crystal report

查看:61
本文介绍了加载水晶报告时出现问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的问题是我的报告在运行时失败.这是我的代码

My problem is that my report is failed at runtime. And here is my code

protected void Page_Load(object sender, EventArgs e)
   {

       ReportDocument report = new ReportDocument();

       report.Load(MapPath("D:\\WebSite1\\Consumed _Leave.rpt"));

       report.SetParameterValue("@FromDate", TextBox1.Text);
       report.SetParameterValue("@ToDate", TextBox2.Text);
       CrystalReportViewer1.ReportSource = report;

   }



如果给定的路径不是虚拟路径,则会发生错误.

请解决我的问题..



and error occurs is path given is not a virtual path.

Pls solve my problem..

推荐答案

可能我会在此行本身中找到错误

Probably I could find error in this line itself

report.Load(MapPath("D:\\WebSite1\\Consumed _Leave.rpt"));



如果使用的是mappath,则仅提供FileName或更靠近的位置,而无需提供完整路径,或者如果您在运行时知道完整路径,则无需使用mappath.

希望对您有所帮助.



If you are using mappath then just provide only FileName or nearer location no need to provide fullpath, or if you know the full path at runtime then no need to use mappath.

Hope it helps.


这篇关于加载水晶报告时出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆