Sami-L Sami-L - 1 month ago 13
ASP.NET (C#) Question

rdlc report - ‘A data source instance has not been supplied for the data source’ error

In my ASP.Net Web pages project I have created a new Web page and I dragged a script manager control onto it, then I created a new rdlc report using the wizard and configured the dataset (to show 3 fields of Products table: ProductName, quatityPerUnit, Price) which begun to retrieve data.

At the following step, I inserted a new Reportviewer and bound it to the previously created report, then again I verified that the data is retrieved by opening the dataset1.xsd file and clicking on preview data.

and this is my web page body code:

<body>
<form id="form1" runat="server">
<div>

<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<rsweb:ReportViewer ID="ReportViewer1" runat="server" Font-Names="Verdana" Font-Size="8pt" WaitMessageFont-Names="Verdana" WaitMessageFont-Size="14pt">
<LocalReport ReportPath="Reports\MyRdlcReport.rdlc">
<DataSources>
<rsweb:ReportDataSource DataSourceId="ObjectDataSource1" Name="dsProducts" />
</DataSources>
</LocalReport>
</rsweb:ReportViewer>
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server" SelectMethod="GetData" TypeName="WebApplication1.dsProductsTableAdapters.ProductsTableAdapter">

</asp:ObjectDataSource>
</div>
</form>
</body>


But When I run the project, I get the next error: A data source instance has not been supplied for the data source ‘dataSource1’, I have tried to find a similar case on the net but succeeded to find nothing, any help please ?

Answer

Finally I found the cause, it was a non corresponding Tablix data set name property. I had to rename it from dataSet1 to dsProducts.