本文介绍了在 asp.net mvc2 中创建水晶报表时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用水晶报告做了一个报告,在页面加载中我正在写这个

I made a report using crystal report and in the page load I am writing this

protected void Page_Load(object sender, EventArgs e)
    {
        ReportDocument crystalReport = new ReportDocument();
        crystalReport.Load(Server.MapPath("CrystalReport.rpt"));
        crystalReport.SetDatabaseLogon
            ("amit", "password", @"AMITSQLEXPRESS", "TestDB");
        CrystalReportViewer1.ReportSource = crystalReport;
    }

在运行页面时我发现了这个错误.

and when runing the page I found this error.

CS0433:c:WindowsassemblyGAC_MSILCrystalDecisions.Web10.5.3700.0__692fbea5521e1304CrystalDecisions.Web.dll"和c:Windowsassembly"中都存在CrystalDecisions.Web.CrystalReportViewer"类型GAC_MSILCrystalDecisions.Web13.0.2000.0__692fbea5521e1304CrystalDecisions.Web.dll'

CS0433: The type 'CrystalDecisions.Web.CrystalReportViewer' exists in both 'c:WindowsassemblyGAC_MSILCrystalDecisions.Web10.5.3700.0__692fbea5521e1304CrystalDecisions.Web.dll' and 'c:WindowsassemblyGAC_MSILCrystalDecisions.Web13.0.2000.0__692fbea5521e1304CrystalDecisions.Web.dll'

推荐答案

我在我的 web.config 中找到了这个标签

I found this tag in my web.config

<add assembly="CrystalDecisions.Web, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304"/>

在我的 aspx 页面中

and in my aspx page

<%@ Register Assembly="CrystalDecisions.Web,  Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304"
    Namespace="CrystalDecisions.Web" TagPrefix="CR" %>

同一程序集的不同版本会产生冲突,所以我删除了 web.config 标记,它运行非常流畅.

different version for the same assembly makes the conflict so I removed web.config tag and it runs very smooth.

谢谢.

这篇关于在 asp.net mvc2 中创建水晶报表时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-04 05:30