当前位置:编程学习 > C#/ASP.NET >>

求助,水晶报表在vs2010可以运行,但是打包后就无法载入报表

求助,水晶报表在vs2010可以运行,但是打包后就无法载入报表
我用的是vs2010和sql2008
还请各位高手帮帮忙,急用,在线等

报表 2010 sql --------------------编程问答-------------------- 模板整进去了?
看看详细信息里说什么了///// --------------------编程问答-------------------- 在vs2010开发环境中报表完美运行,但是我把程序打包后,就出现上面问题,你说的模板指的是哪个?是rpt报表文件吗? --------------------编程问答-------------------- 详细信息如下:


************** 异常文本 **************
CrystalDecisions.Shared.CrystalReportsException: 加载报表失败。 ---> System.Runtime.InteropServices.COMException: 不支持的操作。无法在 C++ 堆栈中打开由 JRC 引擎处理的文档。
   在 CrystalDecisions.ReportAppServer.ClientDoc.ReportClientDocumentClass.Open(Object& DocumentPath, Int32 Options)
   在 CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.Open(Object& DocumentPath, Int32 Options)
   在 CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.EnsureDocumentIsOpened()
   --- 内部异常堆栈跟踪的结尾 ---
   在 CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.EnsureDocumentIsOpened()
   在 CrystalDecisions.CrystalReports.Engine.ReportDocument.Load(String filename, OpenReportMethod openMethod, Int16 parentJob)
   在 CrystalDecisions.CrystalReports.Engine.ReportDocument.Load(String filename)
   在 DLAPSS.print.Frm_PrintRK.Frm_PrintRK_Load(Object sender, EventArgs e) 位置 E:\仓储\20130228 - 打包\DLAPSS\DLAPSS\print\Frm_PrintRK.cs:行号 54
   在 System.Windows.Forms.Form.OnLoad(EventArgs e)
   在 System.Windows.Forms.Form.OnCreateControl()
   在 System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
   在 System.Windows.Forms.Control.CreateControl()
   在 System.Windows.Forms.Control.WmShowWindow(Message& m)
   在 System.Windows.Forms.Control.WndProc(Message& m)
   在 System.Windows.Forms.ScrollableControl.WndProc(Message& m)
   在 System.Windows.Forms.Form.WmShowWindow(Message& m)
   在 System.Windows.Forms.Form.WndProc(Message& m)
   在 System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   在 System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   在 System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


************** 已加载的程序集 **************
mscorlib
    程序集版本: 4.0.0.0
    Win32 版本: 4.0.30319.296 (RTMGDR.030319-2900)
    基本代码: file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll
----------------------------------------
DLAPSS

  程序集版本: 1.0.0.0
    Win32 版本: 1.0.0.0
    基本代码: file:///C:/Program%20Files%20(x86)/Microsoft/Setup1/DLAPSS.exe
----------------------------------------
System.Windows.Forms
    程序集版本: 4.0.0.0
    Win32 版本: 4.0.30319.1002 built by: RTMGDR
    基本代码: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System.Drawing
    程序集版本: 4.0.0.0
    Win32 版本: 4.0.30319.1001 built by: RTMGDR
    基本代码: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System
    程序集版本: 4.0.0.0
    Win32 版本: 4.0.30319.1001 built by: RTMGDR
    基本代码: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Configuration
    程序集版本: 4.0.0.0
    Win32 版本: 4.0.30319.1 (RTMRel.030319-0100)
    基本代码: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Xml
    程序集版本: 4.0.0.0
    Win32 版本: 4.0.30319.1 built by: RTMRel
    基本代码: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
System.Data
    程序集版本: 4.0.0.0
    Win32 版本: 4.0.30319.1 (RTMRel.030319-0100)
    基本代码: file:///C:/Windows/Microsoft.Net/assembly/GAC_32/System.Data/v4.0_4.0.0.0__b77a5c561934e089/System.Data.dll
----------------------------------------
System.Core
    程序集版本: 4.0.0.0
    Win32 版本: 4.0.30319.1 built by: RTMRel
    基本代码: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll
----------------------------------------
System.Transactions
    程序集版本: 4.0.0.0
    Win32 版本: 4.0.30319.1 (RTMRel.030319-0100)
    基本代码: file:///C:/Windows/Microsoft.Net/assembly/GAC_32/System.Transactions/v4.0_4.0.0.0__b77a5c561934e089/System.Transactions.dll
----------------------------------------
System.EnterpriseServices
    程序集版本: 4.0.0.0
    Win32 版本: 4.0.30319.1 (RTMRel.030319-0100)
    基本代码: file:///C:/Windows/Microsoft.Net/assembly/GAC_32/System.EnterpriseServices/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.EnterpriseServices.dll
----------------------------------------
System.Windows.Forms.resources
    程序集版本: 4.0.0.0
    Win32 版本: 4.0.30319.1 built by: RTMRel
    基本代码: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms.resources/v4.0_4.0.0.0_zh-Hans_b77a5c561934e089/System.Windows.Forms.resources.dll
----------------------------------------
CrystalDecisions.Windows.Forms
    程序集版本: 13.0.2000.0
    Win32 版本: 13.0.0.99
    基本代码: file:///C:/Windows/assembly/GAC_MSIL/CrystalDecisions.Windows.Forms/13.0.2000.0__692fbea5521e1304/CrystalDecisions.Windows.Forms.dll
----------------------------------------
CrystalDecisions.CrystalReports.Engine
    程序集版本: 13.0.2000.0
    Win32 版本: 13.0.0.99
    基本代码: file:///C:/Windows/assembly/GAC_MSIL/CrystalDecisions.CrystalReports.Engine/13.0.2000.0__692fbea5521e1304/CrystalDecisions.CrystalReports.Engine.dll
----------------------------------------
CrystalDecisions.Shared
    程序集版本: 13.0.2000.0
    Win32 版本: 13.0.0.99
    基本代码: file:///C:/Windows/assembly/GAC_MSIL/CrystalDecisions.Shared/13.0.2000.0__692fbea5521e1304/CrystalDecisions.Shared.dll
----------------------------------------
CrystalDecisions.ReportSource
    程序集版本: 13.0.2000.0
    Win32 版本: 13.0.0.99
    基本代码: file:///C:/Windows/assembly/GAC_MSIL/CrystalDecisions.ReportSource/13.0.2000.0__692fbea5521e1304/CrystalDecisions.ReportSource.dll
----------------------------------------
System.Web
    程序集版本: 4.0.0.0
    Win32 版本: 4.0.30319.272 built by: RTMGDR
    基本代码: file:///C:/Windows/Microsoft.Net/assembly/GAC_32/System.Web/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Web.dll
----------------------------------------
log4net
    程序集版本: 1.2.10.0
    Win32 版本: 1.2.10.0
    基本代码: file:///C:/Windows/assembly/GAC_32/log4net/1.2.10.0__692fbea5521e1304/log4net.dll
----------------------------------------
CrystalDecisions.Shared.resources
    程序集版本: 13.0.2000.0
    Win32 版本: 13.0.0.99
    基本代码: file:///C:/Windows/assembly/GAC_MSIL/CrystalDecisions.Shared.resources/13.0.2000.0_zh-CHS_692fbea5521e1304/CrystalDecisions.Shared.resources.dll
----------------------------------------
CrystalDecisions.Windows.Forms.resources
    程序集版本: 13.0.2000.0
    Win32 版本: 13.0.0.99
    基本代码: file:///C:/Windows/assembly/GAC_MSIL/CrystalDecisions.Windows.Forms.resources/13.0.2000.0_zh-CHS_692fbea5521e1304/CrystalDecisions.Windows.Forms.resources.dll
----------------------------------------
CrystalDecisions.ReportAppServer.CommLayer
    程序集版本: 13.0.2000.0
    Win32 版本: 13.0.0.99
    基本代码: file:///C:/Windows/assembly/GAC_MSIL/CrystalDecisions.ReportAppServer.CommLayer/13.0.2000.0__692fbea5521e1304/CrystalDecisions.ReportAppServer.CommLayer.dll
----------------------------------------
CrystalDecisions.ReportAppServer.ClientDoc
    程序集版本: 13.0.2000.0
    Win32 版本: 13.0.0.99
    基本代码: file:///C:/Windows/assembly/GAC_MSIL/CrystalDecisions.ReportAppServer.ClientDoc/13.0.2000.0__692fbea5521e1304/CrystalDecisions.ReportAppServer.ClientDoc.dll
----------------------------------------
CrystalDecisions.ReportAppServer.DataDefModel
    程序集版本: 13.0.2000.0
    Win32 版本: 13.0.0.99
    基本代码: file:///C:/Windows/assembly/GAC_MSIL/CrystalDecisions.ReportAppServer.DataDefModel/13.0.2000.0__692fbea5521e1304/CrystalDecisions.ReportAppServer.DataDefModel.dll
----------------------------------------
CrystalDecisions.ReportAppServer.CubeDefModel
    程序集版本: 13.0.2000.0
    Win32 版本: 13.0.0.99
    基本代码: file:///C:/Windows/assembly/GAC_MSIL/CrystalDecisions.ReportAppServer.CubeDefModel/13.0.2000.0__692fbea5521e1304/CrystalDecisions.ReportAppServer.CubeDefModel.dll
----------------------------------------
CrystalDecisions.ReportAppServer.ReportDefModel
    程序集版本: 13.0.2000.0
    Win32 版本: 13.0.0.99
    基本代码: file:///C:/Windows/assembly/GAC_MSIL/CrystalDecisions.ReportAppServer.ReportDefModel/13.0.2000.0__692fbea5521e1304/CrystalDecisions.ReportAppServer.ReportDefModel.dll
----------------------------------------


----------------------------------------
mscorlib.resources
    程序集版本: 4.0.0.0
    Win32 版本: 4.0.30319.1 (RTMRel.030319-0100)
    基本代码: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/mscorlib.resources/v4.0_4.0.0.0_zh-Hans_b77a5c561934e089/mscorlib.resources.dll
----------------------------------------

************** JIT 调试 **************
要启用实时(JIT)调试,
该应用程序或计算机的 .config 文件(machine.config)的 system.windows.forms 节中必须设置
jitDebugging 值。
编译应用程序时还必须启用
调试。

例如: 

<configuration>
    <system.windows.forms jitDebugging="true" />
</configuration>

启用 JIT 调试后,任何未经处理的异常
都将被发送到在此计算机上注册的 JIT 调试器,
而不是由此对话框处理。

--------------------编程问答-------------------- 你加载的报表文件的路径在哪?

在 DLAPSS.print.Frm_PrintRK.Frm_PrintRK_Load(Object sender, EventArgs e) 位置 E:\仓储\20130228 - 打包\DLAPSS\DLAPSS\print\Frm_PrintRK.cs:行号 54这一行是做什么处理的? --------------------编程问答-------------------- 额 呵呵 看到你了 --------------------编程问答-------------------- 应该是打包后的路径错了···改成程序集运行的相对路径···估计当初用了绝对路径了·· --------------------编程问答-------------------- 打包的路径在那里改??? --------------------编程问答-------------------- E:\仓储\20130228 - 打包\DLAPSS\DLAPSS\print\Frm_PrintRK.cs:行号 54这一行是做什么处理的?


这一行是报表的主窗体 --------------------编程问答--------------------
引用 7 楼 fengyuanqing 的回复:
打包的路径在那里改???


你要将你引用报表的那一行代码贴出来啊··· --------------------编程问答--------------------
引用 8 楼 fengyuanqing 的回复:
E:\仓储\20130228 - 打包\DLAPSS\DLAPSS\print\Frm_PrintRK.cs:行号 54这一行是做什么处理的?


这一行是报表的主窗体

这一行你的代码是什么? --------------------编程问答-------------------- 楼主解决了吗?我也遇到同样的问题 --------------------编程问答-------------------- 我这里是这样获取路径的,在本机运行没问题,打包发布就报加载报表失败。
 //获取报表路径
            string strReportPath = Application.StartupPath.Substring(0, Application.StartupPath.Substring(0,
                Application.StartupPath.LastIndexOf("\\")).LastIndexOf("\\"));
            strReportPath += @"\Molde\" + strReportFileName;
            //得到dt数据源
            DataTable dt = db.GetDataTable(strSql, strTable);
            //ReportDocument对象加载rpt文件并绑定到数据源dt
            ReportDocument reportDoc = new ReportDocument();
            reportDoc.Load(strReportPath);
            reportDoc.SetDataSource(dt.DefaultView);
--------------------编程问答-------------------- CrystalReport for vs2010 水晶报表安装方式如下:
1、在你的开发环境中找到Visual Studio安装目录下的"SDK"v2.0"BootStrapper"Packages"CrystalReports,将安装文件CRRedist2010_x86.msi,复制到服务器中并安装。

2、如果程序还不能运行,需要将水晶报表的五个dll文件复制到你的网站下的bin目录,其五大将的名称如下:

     CrystalDecisions.CrystalReports.Engine.dll

     CrystalDecisions.ReportSource.dll

     CrystalDecisions.Shared.dll

     CrystalDecisions.Web.dll

     CrystalDecisions.Windows.Forms.dll --------------------编程问答-------------------- 除 --------------------编程问答-------------------- 楼主解决了吗?遇到同样问题,急求答案呢。qq:181969108,谢谢! --------------------编程问答-------------------- 打包时要添加水晶报表模板 --------------------编程问答-------------------- 除 --------------------编程问答-------------------- 打包时要添加水晶报表模板 和水晶报表的支持程序;

--------------------编程问答-------------------- 除 --------------------编程问答-------------------- 最简单的方法就是:打包完成后,看安装程序文件夹的文件 是否和你打包程序里的文件数目相同。假如安装程序文件夹和你打包程序文件数目不统一,肯定就有问题了。
补充:.NET技术 ,  C#
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,