Using a shared data source for dynamically generated and deployed reports

后端 未结 1 1589
自闭症患者
自闭症患者 2021-02-08 01:14

I\'m dynamically generating RDL files for SSRS 2008, assembling my reports from \"building blocks\" which I defined as reports on Report Server, and which I use as subreports on

相关标签:
1条回答
  • 2021-02-08 01:39

    Answering my own question here, hoping someone else might find this useful:

    I was under the (false) impression that the unique "DataSourceID" given to a data source on the server would be sufficient to identify it uniquely.

    So in my generated RDL, I had something like :

      <DataSources>
        <DataSource Name="MyDataSource">
          <Transaction>true</Transaction>
          <DataSourceReference>MyDataSource</DataSourceReference>
          <rd:DataSourceID>6ba7c588-e270-4de9-988c-d2af024f10e1</rd:DataSourceID>
          <rd:SecurityType>None</rd:SecurityType>
        </DataSource>
      </DataSources>
    

    Now this worked once, when my data source was indeed called "MyDataSource" and located in the same directory as my report which I published through the RS WebService API.

    As soon as I moved the data source elsewhere, it stopped working.

    THE SOLUTION:
    This may sound silly, but I really didn't "get it" at first: the DataSourceReference needs to have the full and complete "path" on the Reporting Server to that data source I want to reference. Just specifying the unique ID won't do....

    So once I changed my RDL to:

      <DataSources>
        <DataSource Name="MyDataSource">
          <Transaction>true</Transaction>
          <DataSourceReference>/MyProject/DataSources/MyDataSource</DataSourceReference>
          <rd:DataSourceID>6ba7c588-e270-4de9-988c-d2af024f10e1</rd:DataSourceID>
          <rd:SecurityType>None</rd:SecurityType>
        </DataSource>
      </DataSources>
    

    (notice the <DataSourceReference>/MyProject/DataSources/MyDataSource</DataSourceReference>)

    since that moment it works like a charm.

    Hope someone might find this useful some day!

    0 讨论(0)
提交回复
热议问题