none
A data source instance has not been supplied for the data source 'DataSet1_Clientes'.

    Question

  • Hello i'm cuban and i'm doing an aplication in Visual Studio 2005. I have a problem with this code because i have an error. I want dinamically load differents reports in one page usin the reportviewer control. This is my code. please help me and tell me what's wrong here. This code i'ts for a test
     

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    Me.ReportViewer1.ProcessingMode = ProcessingMode.Local

    Me.ReportViewer1.LocalReport.ReportPath = "C:\Inetpub\wwwroot\pepe1\report1.rdlc"

    Me.ReportViewer1.LocalReport.DataSources.Add(New ReportDataSource("clientes", cargar()))

    Me.ReportViewer1.LocalReport.Refresh()

    End Sub

    Function cargar() As Data.DataSet

    Dim con As New SqlConnection("Data Source=(local);Initial Catalog=contenedores;Persist Security Info=True;User ID=sa")

    Dim tabla As New Data.DataSet

    Dim adapter As New SqlDataAdapter("select * from clientes", con)

    adapter.Fill(tabla)

    Return tabla

    End Function

     

    when i load my page this i'ts the error on the page:

    • A data source instance has not been supplied for the data source 'DataSet1_Clientes'.

    If i put an Objectdatasource in my webform, this dont happen and it works good, but i want to use many reportrts (*.rdlc)  files with the same webform and including parameters too. Please if you have some examples please send my this (even in C# dont matter). thanks for everething.

     

    I'm sorry for my bad english jajajajaja. bye

     please answer me to this email pepe_ballaga@yahoo.com
    Thursday, February 23, 2006 7:25 PM

Answers

  • The first parameter to ReportDataSource is the name of the data source as defined in the report definition.  In your case, this is "DataSet1_Clientes" (from the error message), not "clientes" that you are currently passing in.
    Thursday, February 23, 2006 8:56 PM

All replies

  • The first parameter to ReportDataSource is the name of the data source as defined in the report definition.  In your case, this is "DataSet1_Clientes" (from the error message), not "clientes" that you are currently passing in.
    Thursday, February 23, 2006 8:56 PM
  • Hello Brian, thanks for your answer, but even doing like you say, the page give me the same error. thanks again man.

    ¿do you have some examples to me?. please send it to me. bye

     

    Friday, February 24, 2006 1:32 PM
  • Me.ReportViewer1.LocalReport.DataSources.Add(New ReportDataSource("clientes", cargar()))

    in C#, it should be cargar().Clientes,

    Hope it helps your VB.

    Long

    Friday, February 24, 2006 10:03 PM
  • u can write this

    Me.ReportViewer1.LocalReport.DataSources.Add(New ReportDataSource("DataSet1_Clientes", cargar()))


    Hope its working.....

    Good luck


    Friday, January 19, 2007 6:00 AM
  • Hi,

    Open report1.rdlc into Visual Studio 2005 and Click Report Menu - Data source. Find How many datasources are there. If you find 2 datasources then

    Me.ReportViewer1.LocalReport.DataSources.Add(New ReportDataSource("DataSet1_Clientes", cargar()))
    Me.ReportViewer1.LocalReport.DataSources.Add(New ReportDataSource("DataSet2_Clientes", cargar()))

    assign like this.

    It will work.

    Good luck.
    • Proposed as answer by Reveles Wednesday, May 13, 2009 11:16 PM
    Wednesday, April 01, 2009 2:42 PM
  • Just select "Choose Data Sources" in the ReportView Tasks. In the Data Source Instance choose your  Current BindingSource that you created, click ok... and thats all

    thats work for me

    Wednesday, May 13, 2009 11:22 PM
  • The Answer is in this method ... Reset () ... you must reset the report viewer befor changing the data source .... a typical working code may look like this :

     

     
            ReportViewer1.Reset();
            ReportViewer1.LocalReport.DataSources.Clear();
            ReportDataSource ds = new ReportDataSource("DataSet_DataTable1",ObjectDataSource1);
            ds.DataSourceId = "ObjectDataSource1";
            
            ReportViewer1.LocalReport.DataSources.Add(ds);
            
            ReportViewer1.LocalReport.ReportPath = "NewReportToView.rdlc";
           
                  
            ReportViewer1.LocalReport.Refresh();
    
    


    Best regards ... please mark it as the answer if you find it usefull ... :)  ^_^
    Saturday, December 12, 2009 3:33 PM
  • I know this is an old thread, but let me give a few more pointers since it shows up early on in the search.

    First, I have to define the report (IssueView.rdlc) with a dataset, then bind columns and such to dataset elements.  However, that dataset (actually a view defined in my SQL Server database) is relatively worthless in display terms.  However, it does contain the fields I need to show.  So I create a DataSet which contains the actual values.  A few things to note:

    1. The field names in the DataSet must correspond exactly to field names in the original view.

    2. The name of the dataset in the ReportDataSet object must be exactly the same as the name of the dataset specified when I created the report.  The following code works:

     

    this.viewerInstance.LocalReport.DataSources.Clear();

     

    DataSet ds = new DataSet();

    ds.Tables.Add(

    "A");

    ds.Tables[

    "A"].Columns.Add("ID");

    ds.Tables[

    "A"].Columns.Add("DateCreated");

    ds.Tables[

    "A"].Columns.Add("DCNOld");

    ds.Tables[

    "A"].Columns.Add("UserID");

    ds.Tables[

    "A"].Columns.Add("BusinessUnit");

    ds.Tables[

    "A"].Columns.Add("FKIssueID");

     

    object[] oData = new object[ds.Tables["A"].Columns.Count];

     

    foreach (var ql in qLog)

    {

    oData[0] = ql.ID;

    oData[1] = ql.DateCreated;

    oData[2] = ql.DCNOld;

    oData[3] = ql.UserID;

    oData[4] = ql.BusinessUnit;

    oData[5] = ql.FKIssueID;   // In the production version there is code to turn this into a list of descriptions, which in WPF is handled by a value converter.

    ds.Tables[

    "A"].Rows.Add(oData);

    }

    viewerInstance.Reset();

     

    this.viewerInstance.LocalReport.ReportEmbeddedResource = "IssueTracker.IssueView.rdlc";

     

    ReportDataSource rds = new ReportDataSource();

    rds.Name =

    "IssueTracker_viewIssueLog";

    rds.Value = ds.Tables[

    "A"];

    viewerInstance.LocalReport.DataSources.Add(rds);

    viewerInstance.RefreshReport();


    Alpha Geek
    Monday, June 21, 2010 3:36 PM
  • in vb.net its gives error a data source instance has not been supplied for the datasource 'dataset1'

    Tuesday, September 11, 2012 7:41 AM