繁体   English   中英

web.Config未提供ASP.NET ReportViewer数据源连接字符串

[英]ASP.NET ReportViewer Datasource connectionstring not supplied from web.Config

我已使用.NET Framework 4.5在VS 2012中创建了ASP.NET空Web应用程序。 我还向该项目添加了报告。 在Web.Config内部,我已经设置了连接字符串。

处理报表时,没有像在Windows窗体应用程序中那样添加数据源的选项。 我想将此Web应用程序连接到库中的对象。

编辑:将库引用添加到项目后,为什么不能访问对象数据源类型? 为什么必须添加一个辅助类来访问库对象。 为此,必须要做的是: 这里

您可以通过编程方式执行此操作:

ReportViewer1.LocalReport.ReportPath = "Report1.rdlc";
ReportViewer1.LocalReport.DataSources.Clear();
ReportViewer1.LocalReport.DataSources.Add(new ReportDataSource("DataSet1", dt));

dt将是您的dataTable

编辑:

<rsweb:ReportViewer ID="ReportViewer1" runat="server">
    <LocalReport ReportEmbeddedResource="Report1.rdlc" ReportPath="Report1.rdlc">
        <DataSources>
            <rsweb:ReportDataSource DataSourceId="ObjectDataSource1" Name="DataSet1" />
        </DataSources>
    </LocalReport>
</rsweb:ReportViewer>
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server">
</asp:ObjectDataSource>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM