无法在rdlc报告asp.net上显示数据

时间:2018-07-04 16:46:55

标签: c# asp.net visual-studio-2017 reportviewer

我正在使用存储过程和报告的详细信息。我正在使用报表查看器和数据集;但是我似乎只是在aspx文件中出现错误:

  

创建控件时出错-ReportViewer1无法创建设计器   'Microsoft.Reporting.WebForms.ReportViewer,   Microsoft.ReportViewer.WebForms,版本= 11.0.0.0,文化=中性,   PublicKeyToken = 89845dcd8080cc91'

但是当我执行它时,它仅显示此内容,而报告中没有任何详细信息。

图片:

see image

html

    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Report.aspx.cs" Inherits="Student_Report" %>

<%@ Register Assembly="Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" Namespace="Microsoft.Reporting.WebForms" TagPrefix="rsweb" %>







<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Student Report</title>
</head>
<body>
    <form id="form1" runat="server" style="text-align: center">
        <h1 style="font-family: 'Comic Sans MS'; text-align: center; font-size: xx-large;">Student Report
        </h1>

  <asp:ScriptManager ID="ScriptManager1" runat="server">
            </asp:ScriptManager>
        <rsweb:ReportViewer ID="ReportViewer1" runat="server">
        </rsweb:ReportViewer>


    </form>
</body>
</html>

隐藏代码

if (!IsPostBack)
    {
        string strSQLconstring = System.Configuration.ConfigurationManager.ConnectionStrings["constr"].ToString();
        ReportViewer1.ProcessingMode = ProcessingMode.Local;
        //report path
        ReportViewer1.LocalReport.ReportPath = Server.MapPath("~/Report.rdlc");
        SqlDataAdapter adp = new SqlDataAdapter("sp_StudentData", strSQLconstring);
        adp.SelectCommand.CommandType = CommandType.StoredProcedure;
        //object of Dataset DemoDataSet
        TWCL_OPERATIONSDataSet ds = new TWCL_OPERATIONSDataSet();
        adp.Fill(ds, "sp_StudentData");
        //Datasource for report
        ReportDataSource datasource = new ReportDataSource("DataSet1", ds.Tables[0]);
        ReportViewer1.Width = 2000;

        ReportViewer1.LocalReport.DataSources.Clear();
        ReportViewer1.LocalReport.DataSources.Add(datasource);
        ReportViewer1.LocalReport.Refresh();
    }

我已经做了一些研究,但似乎无法弄清楚自己做错了什么。

0 个答案:

没有答案