RDLC Report: A data source instance has not been supplied for the data source

Last Reply on Jul 08, 2015 01:54 AM By Mudassar

Posted on Jul 08, 2015 01:44 AM
  • A data source instance has not been supplied for the data source 'bramandamDataSet_Expenzsection'.


<asp:TextBox ID="txtID" runat="server"></asp:TextBox>
    <asp:Button ID="btn1" runat="server" Text="Generate report"
        onclick="btn1_Click" />
        <br />
        <br />
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        <br />
        <rsweb:ReportViewer ID="ReportViewer1" runat="server" Font-Names="Verdana"
            Font-Size="8pt" Height="318px" Width="1094px">
            <localreport reportpath="Report2.rdlc">
                    <rsweb:ReportDataSource DataSourceId="ObjectDataSource1"  Name="bramandamDataSet_Expenzsection" />
        <asp:ObjectDataSource ID="ObjectDataSource1" runat="server"  InsertMethod="Insert" OldValuesParameterFormatString="original_{0}"    SelectMethod="GetData"   TypeName="bramandamDataSetTableAdapters.ExpenzsectionTableAdapter">
                <asp:Parameter Name="sectionname" Type="String" />
                <asp:Parameter Name="ExpensesName" Type="String" />
                <asp:Parameter Name="Date" Type="String" />
                <asp:Parameter Name="BillNo" Type="String" />
                <asp:Parameter Name="BillAmount" Type="Double" />


 protected void btn1_Click(object sender, EventArgs e)
        ReportViewer1.Visible = true;
         string id = txtID.Text;
            ReportViewer1.ProcessingMode = ProcessingMode.Local;
            ReportViewer1.LocalReport.ReportPath = Server.MapPath("~/Report2.rdlc");
            DataSet ds = new DataSet();
            ds = GetData(id);
            if (ds.Tables[0].Rows.Count > 0)
                ReportDataSource rds = new ReportDataSource("bramandamDataSet", ds.Tables[0]);



 private DataSet GetData(string id)
           SqlConnection con = new SqlConnection("Data Source=FLOOR1\\SQLEXPRESS;Initial Catalog=bramandam;Integrated Security=True");
            SqlCommand cmd = new SqlCommand();
            string qry ="select sectionname,expensesname,date,billno,billamount from expenzsection where date='" + id + "'order by sectionname";
            SqlDataAdapter da = new SqlDataAdapter();
            cmd = new SqlCommand(qry, con);
            da = new SqlDataAdapter(cmd);
            return ds;



Posted on Jul 08, 2015 01:54 AM

You are setting DataSource from code as well as from ASPX.

Use anyone