Asked by:
A data source instance has not been supplied for the data source 'DataSet1'.

Question
-
User989035446 posted
Hi,
I have a rdlc report but it is not working. It show me this error at run time.
Below is my code:
Client side ----------------------- <rsweb:ReportViewer ID="ReportViewer1" runat="server" Font-Names="Verdana" Font-Size="8pt" InteractiveDeviceInfos="(Collection)" WaitMessageFont-Names="Verdana" WaitMessageFont-Size="14pt"> <LocalReport ReportPath="Report\Report1.rdlc"> </LocalReport> </rsweb:ReportViewer> Server Side ------------------------ dsMRDtl = SearchMRDtl("EMR9"); ReportDataSource datasource = new ReportDataSource("DataSet1_MRRpt", dsMRDtl.Tables[0]); ReportViewer1.LocalReport.DataSources.Add(datasource); ReportViewer1.LocalReport.Refresh();
Below is the screen on how the dataset is created.
What is missing out actually?
I have tried the whole morning but still do not find out solution for this
Thursday, March 21, 2013 1:24 AM
All replies
-
User522486851 posted
did you fill the DataSet1 before calling the
ReportDataSource datasource = new ReportDataSource("DataSet1_MRRpt", dsMRDtl.Tables[0]);
?
Thursday, March 21, 2013 1:43 AM -
User989035446 posted
Hi Sankalpa,
Yes i have filled the dataset before calling. I am sure that there are 4 records in the dataset. ^^
Thursday, March 21, 2013 1:51 AM -
User143067745 posted
johnsonlim026
Server Side ------------------------ dsMRDtl = SearchMRDtl("EMR9"); ReportDataSource datasource = new ReportDataSource("DataSet1_MRRpt", dsMRDtl.Tables[0]); ReportViewer1.LocalReport.DataSources.Add(datasource); ReportViewer1.LocalReport.Refresh();
Rather than using this code you can take an ObjectDataSource control(located at Data in Toolbox of VS) and configure it for the dataset and then you can assign it as datasource to ReportViewer, You can do all these in design mode so it is more easy as well.
Thursday, March 21, 2013 2:16 AM -
User522486851 posted
Cauld you please post your full server side code?
Thursday, March 21, 2013 2:39 AM -
User989035446 posted
Hi Sankalpa,
This is all my code.CAn you help?
--Client Side <form id="form1" runat="server"> <asp:ScriptManager ID="ScriptManager1" runat="server" ScriptMode="Release"> </asp:ScriptManager> <div> </div> <rsweb:ReportViewer ID="ReportViewer1" runat="server" Font-Names="Verdana" Font-Size="8pt" InteractiveDeviceInfos="(Collection)" WaitMessageFont-Names="Verdana" WaitMessageFont-Size="14pt"> <LocalReport ReportPath="Report\Report1.rdlc"> </LocalReport> </rsweb:ReportViewer> <asp:ObjectDataSource ID="ObjectDataSource1" runat="server"> </asp:ObjectDataSource> </form> ----Server Side protected void Page_Load(object sender, EventArgs e) { try { DataSet dsMRDtl = new DataSet(); ViewState["MRNo"] = "EMR9"; ViewState["MRNo"] = Request.QueryString["MRNo"]; dsMRDtl = SearchMRDtl("EMR9"); ReportDataSource datasource = new ReportDataSource("DataSet1_MRRpt", dsMRDtl.Tables[0]); ReportViewer1.LocalReport.DataSources.Add(datasource); ReportViewer1.LocalReport.Refresh(); } catch (Exception ex) { throw ex; } }
Friday, March 22, 2013 3:43 AM -
User989035446 posted
Hi mishra,
I have try with Data source, but nothing coming out, not even error message.Do you have any ide how to configure?
Do you have any idea which Object i need to choose? Dataset1?DataSet1 + MRRptDataTable<Table i created in Solution Explorer> and also which data methods i need to user?
Attached is the picture
Help Please!!
Friday, March 22, 2013 4:15 AM