I am creating an application to upload SSRS .rdl files to our report server. This is using ReportingService2010()
The upload of the .RDL file works fine.
Next, the application should assign a specified datasource to the uploaded .RDL file, but this element is failing. My code is shown below:
DataSource[] dsarray = new DataSource[1];
string DSName = "MyDataSource";
DataSourceReference reference = new DataSourceReference();
DataSource ds = new DataSource();
dsarray[0] = new DataSource();
reference.Reference = "/" + DSName;
ds.Item = reference;
ds.Name = "/" + DSName;
dsarray[0] = ds;
rs.SetItemDataSources("/" + location + "/" + filename, dsarray);
I get the following error message:
The following error occured:
The data source '/MyDataSource' cannot be found. Microsoft.ReportingServices.Diagnostics.Utilities.DataSourceNotFoundException: The data source '/MyDataSource' cannot be found.
I'm pretty sure I'm very close, but I just can't get it working. I have tried many different solutions & looked online extensively (including stack overflow!), but I can't find examples relevant to my issue. Most discussions relate to ReportingServices2005.
I should mention my datasource resides in the root folder '/' as this is a development server.
I am relatively inexperienced with c# so perhaps I am missing something obvious. Any info/idea's would be very much appreciated, many thanks in advance.