解决方案 »

  1.   

    在vs2010开发环境中报表完美运行,但是我把程序打包后,就出现上面问题,你说的模板指的是哪个?是rpt报表文件吗?
      

  2.   

    详细信息如下:
    ************** 异常文本 **************
    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 调试器,
    而不是由此对话框处理。
      

  3.   

    你加载的报表文件的路径在哪?在 DLAPSS.print.Frm_PrintRK.Frm_PrintRK_Load(Object sender, EventArgs e) 位置 E:\仓储\20130228 - 打包\DLAPSS\DLAPSS\print\Frm_PrintRK.cs:行号 54这一行是做什么处理的?
      

  4.   

    E:\仓储\20130228 - 打包\DLAPSS\DLAPSS\print\Frm_PrintRK.cs:行号 54这一行是做什么处理的?
    这一行是报表的主窗体
      

  5.   

    我这里是这样获取路径的,在本机运行没问题,打包发布就报加载报表失败。 //获取报表路径
                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);
      

  6.   

    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