Alex Gordon
Alex Gordon

Reputation: 60711

How to add datasource to the code in ssrs?

When you create a shared data source,it puts this in the code of a report:

 <DataSources>
    <DataSource Name="KISdfgdfgQL1">
      <DataSourceReference>KISdfgdfgQL1</DataSourceReference>
      <rd:SecurityType>None</rd:SecurityType>
      <rd:DataSourceID>45ad295c-cc2f-438sdfsdf3833230</rd:DataSourceID>
    </DataSource>
  </DataSources>

I just created a new datasource, and want to use it inside an existing report.

When I tried to deploy the solution I am getting this message:

Error   1   [rsInvalidDataSourceReference] The dataset ‘Community’ refers to the data source “my_new_datasource”, which does not exist. 

I did indeed create the new datsource, however, it did not create the tags for it inside the code:

<rd security type...
< datasource id...

How can I force SSRS to use this new datasource that I've created?

im using vs 2010

Upvotes: 1

Views: 4404

Answers (1)

djangojazz
djangojazz

Reputation: 13242

Generally when you deploy to an SSRS server with a Shared Data Source I find that if you reference something that has yet to be deployed due to a change it will bomb. If you change an existing Shared Data Source it may bomb as the default behavior for SSRS Deployment is to NOT overwrite datasources. Even if you have the shared Datasource already existing. I am not certain but this could be due to the naming of the 'alias' of your shared data source being different or simply any changes may change the GUID of the datasource. You can fix this manually generally by:

  1. Open up the report on SSRS Server hosting the report. (Even if it bombs) Generally it is somewhere like http:// (server)/(Reports)/(path to report).
  2. You can see right above the report parameters or view top a hyperlink with that report name , click it
  3. You now have a management screen. Click 'Data Sources'
  4. If you have a shared Data source a radio button labeled 'A shared data source' will be highlighted. (You may have one or many of these)
  5. If your datasource is not working click to it manually by hitting 'Browse'. Generally the default deployment is under 'Data Sources' off of the root of the SSRS Site.
  6. Once you get the correct data source click ok.
  7. DO NOT FORGET to hit apply in the next window when you get back to 'Data Sources' screen.
  8. (OPTIONAL) you can hit test if your datasource has stored credentials.

If this does not work I would suggest redeploying the shared data source if this is not a production environment and it will not harm anything. Getting SSRS servers to play nice with shared data sources and shared data sets when you make changes to them is sometimes easy but often a minor change makes either the new report or the existing ones get mad. My general rule is get your shared data sources/sets correct and do not change them ever. When you add a source control to the mix it gets even worse.

Upvotes: 1

Related Questions