A data source instance was not provided for data source 'DataSet1'

I create my rdlc report by creating a dataset, but when I run my report this error occurs. "The data source was not provided for the data source DataSet1." I also changed the name of the dataset, but did not improve. I give datasource to inform the viewer through the smart tag.

+4
source share
2 answers

It seems you have not yet set up a data source for Report Viewer data sources.

You can check it in different ways, I offer you two ways:

In the aspx file in the tag, ReportViewermake sure you have the parameter <DataSources>in the tag <LocalReport>. See my sample code:

<rsweb:ReportViewer ID="ReportViewer1" runat="server" Font-Names="Verdana" Font-Size="8pt" WaitMessageFont-Names="Verdana" WaitMessageFont-Size="14pt">
    <LocalReport ReportPath="Report.rdlc">
         <DataSources>
             <rsweb:ReportDataSource DataSourceId="SqlDataSource1" Name="DataSet1" />
         </DataSources>
    </LocalReport>
</rsweb:ReportViewer>

DataSourceId <ReportDataSource> .

ReportViewer . . :

enter image description here

ReportViewer > >

+5

, DataSource ,

DataSet name "FinancialRatios" and Table name "FinInfo"

DataSet Table ,

ReportDataSource datasource = new ReportDataSource("FinancialRatios", dsFinRatios.Tables[0]);

ReportDataSource datasource = new ReportDataSource("FinInfo", dsFinRatios.Tables[0]);

: " " FinancialRatios_FinInfo ".

, DataSource "FinancialRatios_FinInfo", , .

ReportViewer1.ProcessingMode = ProcessingMode.Local;
ReportViewer1.LocalReport.ReportPath = Server.MapPath("~/FinRatioReport.rdlc");
ReportDataSource datasource = new ReportDataSource("FinancialRatios_FinInfo", dsFinRatios.Tables[0]);
ReportViewer1.LocalReport.DataSources.Clear();
ReportViewer1.LocalReport.DataSources.Add(datasource);
0

Source: https://habr.com/ru/post/1525132/


All Articles