XAML 异常错误

lokaqttq  于 2022-12-07  发布在  其他
关注(0)|答案(1)|浏览(136)

我已经在VS 2022中创建了rdlc报告,并尝试运行它,但在reportViewev1.LocalReport.Setparameters()中遇到异常。
报表处理异常错误:报表定义无效。详细信息:报表定义具有无法升级的无效目标命名空间“http://schemas.microsoft.com/sqlserver/reporting/2016/01/reportdefinition”。

定义无效异常:报表“”的定义无效。

namespace WM_App.Views
{
    public partial class Window1 : Window
    {
        public List<string> Labels { get; set; }
        public string VendorItemNo_ { get; set; }
        public string CrossRefNo_ { get; set; }
        public string SelectedLabel { get; set; }

        private Microsoft.Reporting.WinForms.ReportViewer reportViewer1;

        public Window1()
        {
            InitializeComponent();

            Labels = new List<string>
            {
                "Akerman",
                "MetalX"
            };

            this.

            DataContext = this;
        }

        private void Print_Button_Click(object sender, RoutedEventArgs e)
        {
            this.reportViewer1 = new ReportViewer();

            reportViewer1.LocalReport.ReportEmbeddedResource = "WM_App.Reports.Akerman.rdlc";
            reportViewer1.Location = new System.Drawing.Point(0, 0);
            reportViewer1.Name = "reportViewer1";
            reportViewer1.Size = new System.Drawing.Size(667, 439);
            reportViewer1.TabIndex = 0;

            var tt = new ReportParameter("TranslateTable", "ForTest");
            var vgt = new ReportParameter("VehicleGroupTable", "FordTransit");
            var vin = new ReportParameter("VendorItemNo", VendorItemNo_);
            var umt = new ReportParameter("UnitOfMeasureTable", "Test");
            var crn = new ReportParameter("VendorItemNo", CrossRefNo_);

            reportViewer1.LocalReport.SetParameters(tt);
            reportViewer1.LocalReport.SetParameters(vgt);
            reportViewer1.LocalReport.SetParameters(vin);
            reportViewer1.LocalReport.SetParameters(umt);
            reportViewer1.LocalReport.SetParameters(crn);
            reportViewer1.RefreshReport();
xkrw2x1b

xkrw2x1b1#

如果有人有同样的问题,它的解决方案很难找到,但很容易,只需打开你的rdlc报告在记事本和改变报告xmlns到这.

<Report xmlns="http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition" "http://schemas.microsoft.com/SQLServer/reporting/reportdesigner">

希望能有所帮助。

相关问题