首页 新闻 会员 周边

打印报表时报错,求大侠们帮帮忙啊

0
悬赏园豆:100 [待解决问题]

在本地可以正常打印,但传到服务器上后就报以下错误

 

无效文件名。
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。

异常详细信息: System.Runtime.InteropServices.COMException: 无效文件名。

源错误:


行 30:         dd.Load(reportpath);
行 31:       
行 32:         if (Request.QueryString["prm"] != null)


代码:ReportDocument dd = new ReportDocument();
      string reportName = Request.QueryString["rpt"];
      string rptPath = ConfigurationManager.AppSettings["WEBs_ROOT"] + "rptfiles/";
       
      string reportpath = Server.MapPath(rptPath + reportName + ".rpt");
      
      dd.Load(reportpath);

LoveCode的主页 LoveCode | 初学一级 | 园豆:100
提问于:2011-09-21 13:13
< >
分享
所有回答(3)
0
artwl | 园豆:16736 (专家六级) | 2011-09-21 13:28

不是这个原因

支持(0) 反对(0) LoveCode | 园豆:100 (初学一级) | 2011-09-21 13:39

请大侠们帮帮忙哪

支持(0) 反对(0) LoveCode | 园豆:100 (初学一级) | 2011-09-21 14:17

@LoveCode:

服务器系统跟你机子上是一样的吗,系统不同(包括32位跟64位的区别)路径有些也不一样的?是哪一行出错,30行吗?

支持(0) 反对(0) artwl | 园豆:16736 (专家六级) | 2011-09-21 14:21

嗯,服务器系统和我本机的不一样,我本机是XP,服务器是2003,是30行报错

支持(0) 反对(0) LoveCode | 园豆:100 (初学一级) | 2011-09-21 14:42

@LoveCode:

那很有可能是路径不对造成的,仔细检查一下,或输出看看呗

支持(0) 反对(0) artwl | 园豆:16736 (专家六级) | 2011-09-21 15:15

输出路径是正确的,就在那个文件夹下面

支持(0) 反对(0) LoveCode | 园豆:100 (初学一级) | 2011-09-21 15:21
0

你用的是rdlc 吧? 如果是本地端报表,报表后缀应该是rdlc。如果rdl,应该是服务端报表。

试一下改成rdlc格式的呢。

大青岛 | 园豆:142 (初学一级) | 2011-09-21 19:46

我用的是rpt格式的报表,路径和服务器报表存放的路径是一致的

支持(0) 反对(0) LoveCode | 园豆:100 (初学一级) | 2011-09-22 10:07

有没有人遇到过这个错误啊,帮忙看看啊

支持(0) 反对(0) LoveCode | 园豆:100 (初学一级) | 2011-09-23 09:44
0

 

“/”应用程序中的服务器错误。


 

无效文件名。

说明: 执行当前 Web 请求期间,出现未经处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。

异常详细信息: System.Runtime.InteropServices.COMException: 无效文件名。

源错误:

执行当前 Web 请求期间生成了未经处理的异常。可以使用下面的异常堆栈跟踪信息确定有关异常原因和发生位置的信息。


堆栈跟踪:

[COMException (0x800001fb): 无效文件名。]   CrystalDecisions.ReportAppServer.ClientDoc.ReportClientDocumentClass.Open(Object& DocumentPath, Int32 Options) +0   CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.Open(Object& DocumentPath, Int32 Options) +95   CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.EnsureDocumentIsOpened() +270[CrystalReportsException: 加载报表失败。]   CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.EnsureDocumentIsOpened() +333   CrystalDecisions.CrystalReports.Engine.ReportDocument.Load(String filename, OpenReportMethod openMethod, Int16 parentJob) +877   CrystalDecisions.CrystalReports.Engine.ReportDocument.Load(String filename) +84   Prinate.CPrintReport.DisplayReport(String printerName, String strShop_ID) in C:\Users\Administrator\Desktop\Prinate\Prinate\CPrintReport.cs:140   FinancingManage_GrossReport.Page_Load(Object sender, EventArgs e) +272   System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35   System.Web.UI.Control.OnLoad(EventArgs e) +91   System.Web.UI.Control.LoadRecursive() +74   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2207
rbf1987 | 园豆:205 (菜鸟二级) | 2011-12-20 11:33
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册