Binding DataSource to Report C# RRS feed

  • Question

  • User-1121540557 posted

    Hi all,

    I`m having problems with binding my datasource to a report.

    When i upload a new datasource and a report to my report server (via C# code) everything goes well, only thing is when the programm tryes to connect the datasource to the report it says that it cannot find the datasource(See error below


    The data source '/DataSources/DataSource1' cannot be found. --->
    The data source '/DataSources/DataSource1' cannot be found.
    at Microsoft.ReportingServices.WebServer.ReportingService2005Impl.SetItemDataSources
    (String Item, DataSource[] DataSources)
    at Microsoft.ReportingServices.WebServer.ReportingService2005.SetItemDataSources
    (String Item, DataSource[] DataSources)


    Here is the code:(Which is copied from the internet)


                        rsc.CreateReport(aReport.Name, aReport.Folder, true, definition, null);
                        #region Setting Report Data Source
                        DataSourceReference reference = new DataSourceReference();
                        reference.Reference = aReport.DataSource;
                        DataSource[] dataSources = new DataSource[1];
                        DataSource ds = new DataSource();
                        ds.Item = (DataSourceDefinitionOrReference)reference;
                        //ds.Name = aReport.DataSource.ToString();
                        ds.Name = aReport.DataSource.Split('/').Last();                   
                        dataSources[0] = ds;
                        rsc.SetItemDataSources(aReport.Folder + "/" + aReport.Name, dataSources);                    


    It doesn`t matter if i use a new datasource or a existing one(the message stays the same)

    Hope any body can help..

    Best regards,


    Monday, June 13, 2011 2:27 PM

All replies

  • Wednesday, June 15, 2011 5:55 AM
  • User-1121540557 posted

    Hi Nizam,

    I don`t have problems with displaying the report..the only problem there is with uploading the report to the report server and binding a DataSource to the report(No dataset)

    When i upload the datasource and look on the report server, the datasource is uploaded..but when i upload the report and i want to bind the report to a datasource on the report server, i`ll get the message(The datasource "datasource name" could not be Found..

    So i hope you can help me with this..

    Best regards,


    Wednesday, June 15, 2011 12:12 PM
  • User1471008070 posted

    Hi Clubict,

    Could you please open report manager to see the datasouce's property to see whether it has the correct connection string?

    If I misunderstand you, please feel free to let me know.

    Challen Fu

    Thursday, June 16, 2011 4:49 AM
  • User-1121540557 posted

    Hi You-Hu Fu,

    The connection string is proper, because i allready created a report and datasource folder, i`ve uploaded the Datasource and the report to the folder...the onlything that goes wrong is when the application is binding the report to the datasource, then the application says, that it cannot find the datasource on the current location..If i look to the location (in the string) the location is correct.

    So that is why i don`t understand it..hope you or somebody else does..

    Best regards,


    Thursday, June 16, 2011 6:48 AM