Home > OS >  Microsoft.Reporting.WinForms.LocalProcessingException
Microsoft.Reporting.WinForms.LocalProcessingException

Time:07-23

I have created rdlc report in VS 2022 and tried to run it but I get exceptions at reportViewev1.LocalReport.Setparameters(). These are the exceptions

ReportProcessingException: The report definition is not valid. Details: The report definition has an invalid target namespace 'http://schemas.microsoft.com/sqlserver/reporting/2016/01/reportdefinition' which cannot be upgraded.

and

DefinitionInvalidException: The definition of the report '' is invalid.

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();

CodePudding user response:

if someone has same problem it's solution is hard to find but easy, just open your rdlc report in notepad and change Report xmlns to this.

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

hope it helps.

  • Related