2

Report Builder 3.0を使用してレポートを作成し、VS2010のレポートビューアでレポートを表示しようとしています。このエラーメッセージが表示され続けます。

レポート定義が無効です。詳細:レポート定義に無効なターゲット名前空間'http://schemas.microsoft.com/sqlserver/reporting/2010/01/reportdefinition'があり、アップグレードできません。

これが私が使用しているコードです。

public partial class ViewReport : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if(!IsPostBack)
            PopulateReport(GetDataSet("24"), Server.MapPath("/IncidentReportOld.rdl"));
    }
    private DataSet GetDataSet(string id)
    {
        string sql = string.Empty;
        SqlDataAdapter ada;
        string conString = "Data Source=con-sqlc-02;Initial Catalog=Incident;Integrated Security=True";

        DataSet ds = new DataSet();

        sql = "select * from Rpt_Incident where incidentID = " + id;
        ada = new SqlDataAdapter(sql, conString);
        ada.Fill(ds, "Incidents");

        return ds;
    }

    private void PopulateReport(DataSet ds, string reportPath)
    {
        /* Put the stored procedure result into a dataset */

        if (ds.Tables[0].Rows.Count == 0)
        {
            //lblMessage.Text = "Sorry, no record returned in this report";
        }
        else
        {

            // Set ReportViewer1
            ReportViewer rv = new ReportViewer();
            rv.LocalReport.ReportPath = reportPath;
            ReportDataSource datasource;
            rv.LocalReport.DataSources.Clear();
            for (int i = 0; i < ds.Tables.Count; i++)
            {
                datasource = new ReportDataSource(ds.Tables[i].TableName, ds.Tables[i]);
                rv.LocalReport.DataSources.Add(datasource);
            }

            RenderPDF(rv);
        }
    }

    private void RenderPDF(ReportViewer rv)
    {
        Warning[] warnings;
        string[] streamids;
        string mimeType;
        string encoding;
        string extension;

        byte[] bytes = rv.LocalReport.Render("PDF", null, out mimeType, out encoding, out extension, out streamids, out warnings);

        this.Page.Response.ClearHeaders();
        this.Page.Response.AddHeader("content-disposition", "inline; filename=IncidentTest.pdf");
        this.Page.Response.ClearContent();
        this.Page.Response.ContentEncoding = System.Text.Encoding.UTF8;
        this.Page.Response.ContentType = "application/pdf";

        BinaryWriter writer = new BinaryWriter(this.Page.Response.OutputStream);
        writer.Write(bytes);

        writer.Close();

        //flush and close the response object
        this.Page.Response.Flush();
        this.Page.Response.Close();
    }
    private void PopulateReport1(DataSet ds, string reportPath)
    {
        /* Put the stored procedure result into a dataset */

        if (ds.Tables[0].Rows.Count == 0)
        {
            //lblMessage.Text = "Sorry, no record returned in this report";
        }
        else
        {

            // Set ReportViewer1
            //ReportViewer rv = new ReportViewer();
            ReportViewer1.LocalReport.ReportPath = reportPath;
            ReportDataSource datasource;
            ReportViewer1.LocalReport.DataSources.Clear();
            for (int i = 0; i < ds.Tables.Count; i++)
            {
                datasource = new ReportDataSource(ds.Tables[i].TableName, ds.Tables[i]);
                ReportViewer1.LocalReport.DataSources.Add(datasource);
            }

            ReportViewer1.LocalReport.Refresh();
            //RenderPDF(rv);
        }
    }


}
4

3 に答える 3

6

私は実際にこの問題を自分で修正することができました。

拡張機能をRDLからRDLCに変更しました。それから私はそれをVSで開き、VSは私がそれを変換したいかどうか私に尋ねました。はいと言った後、このエラーメッセージが表示されました。

レポート定義に無効なターゲット名前空間'http://schemas.microsoft.com/sqlserver/reporting/2010/01/reportdefinition'があり、アップグレードできません。

So I changed the namespace to this which is for SQL Reporting Services 2008.

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

After that I got an error saying "ReportSections" is an invalid child element. I removed it then everything worked! Hopefully this will help anyone else with this issue.

于 2011-04-14T20:38:34.440 に答える
1

参照のMicrosoft.ReportViewer.Commonおよびの特定のバージョンプロパティを変更することにより、winformsプロジェクトでこの問題を修正しMicrosoft.ReportViewer.WinFormsましたfalse

于 2012-02-01T20:07:23.067 に答える
0

I've had the same problem, but your solution didn't work for me. I'm using VS 2013 express and USED to use ReportBuilder 3.0. I've seen on the msdn forums that using ReportBuilder2.0 will resolve that issue and they were right. So try using Report Builder 2.0.

于 2014-05-01T06:46:12.577 に答える