问题描述
我是 Windows 窗体应用程序的新手.这是我在办公室的第一份申请.我的办公室管理层给了我源代码.但他们对此一无所知.
I'm a novice in the windows form application. It's my first application at the office. My office management gives me the source code. But they don't know anything about it.
我在 Visual Studio 12(64 位)上运行这些代码.一切都在运行,但水晶报告不起作用.引发错误.
I run those codes on visual studio 12 (64 bit). Everything is running, but the crystal report is not working. Throws error.
错误是:
无法转换 COM 类型的对象'CrystalDecisions.ReportAppServer.Controllers.ReportSourceClass' 到接口类型'CrystalDecisions.ReportAppServer.Controllers.ISCRReportSource'.这操作失败,因为 COM 组件上的 QueryInterface 调用对于 IID 为{98CDE168-C1BF-4179-BE4C-F2CFA7CB8398}"的接口由于以下错误而失败:不支持此类接口(来自 HRESULT 的异常:0x80004002 (E_NOINTERFACE)).
Unable to cast COM object of type 'CrystalDecisions.ReportAppServer.Controllers.ReportSourceClass' to interface type 'CrystalDecisions.ReportAppServer.Controllers.ISCRReportSource'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{98CDE168-C1BF-4179-BE4C-F2CFA7CB8398}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).
这是屏幕截图:
代码如下:
ReportDAL rDal = new ReportDAL();
receipt r = new receipt();
DataTable dt = rDal.GetInvoiceHeader(vId);
//string ww = GetInvoiceHeader(vId);
r.Database.Tables["ReceiptDetails"].SetDataSource(rDal.GetInvoiceDetails(vId));
r.Database.Tables["ReceiptHeader"].SetDataSource(rDal.GetInvoiceHeader(vId));
r.SetParameterValue("pReportDeliveryTime", GlobalData.reportDeliveryTime);
crystalReportViewer1.ReportSource = r;
谁能给我一个详细的解决方案?
Can anyone give me a solution elaborately?
推荐答案
我现在也遇到了同样的问题.
The same problem occured with me too, right now.
当我安装 CR 13 Update 21 时,我的项目在运行时出现了同样的异常.
When I installed CR 13 Update 21, my project gave the same exception during runtime.
我刚刚从解决方案资源管理器中删除了所有对 CrystalDecision 的引用(它实际上属于 CR 的早期版本,即 CR 13 Update 20).
I just removed all of the references of CrystalDecision from Solution Explorer (which actually belonged to a previous version of CR i.e. CR 13 Update 20).
然后我添加了来自 Solution Explorer => 的新引用参考=>添加参考
菜单.我从窗口中选择了所需的 CrystalDecision
包.重建,现在问题消失了.
Then I added fresh references from Solution Explorer => References => Add Reference
menu. I selected the required CrystalDecision
packages from the window. Rebuilt, and the problem is gone now.
这篇关于带有水晶报告的 Windows 窗体应用程序错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!