如何解决“本地报告处理期间发生错误。”

时间:2019-04-06 03:01:16

标签: c# asp.net reporting-services rdlc

这是错误消息

 An error occurred during local report processing.
    The definition of the report 'C:\Users\user\Desktop\filteredTRUE\fypTRUE\fypTRUE\adminPages\Report1.rdlc' is invalid.
        An unexpected error occurred in Report Processing.
            Could not load file or assembly 'Microsoft.SqlServer.Types, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The system cannot find the file specified. 

这是背后的代码

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            ReportViewer1.ProcessingMode = ProcessingMode.Local;
            ReportViewer1.LocalReport.ReportPath = Server.MapPath("~/adminPages/Report1.rdlc");
            DataSet1 dsdataSet1 = GetDataSet1("select * from customer");
            ReportDataSource dataSource = new ReportDataSource("DataSet1", dsdataSet1.Tables[0]);
            ReportViewer1.LocalReport.DataSources.Clear();
            ReportViewer1.LocalReport.DataSources.Add(dataSource);
        }
    }

    private DataSet1 GetDataSet1(string query)
    {
        string conString = ConfigurationManager.ConnectionStrings["Database1ConnectionString"].ConnectionString;
        SqlCommand cmd = new SqlCommand(query);
        using (SqlConnection con = new SqlConnection(conString))
        {
            using (SqlDataAdapter sda = new SqlDataAdapter())
            {
                cmd.Connection = con;
                sda.SelectCommand = cmd;
                using (DataSet1 dsDataSet1 = new DataSet1())
                {
                    sda.Fill(dsDataSet1, "DataTable1");
                    return dsDataSet1;
                }
            }
        }
    }

我希望直接显示表格,如https://www.ecanarys.com/Blogs/ArticleID/174/Creating-an-RDLC-report-in-Asp-Net

0 个答案:

没有答案