Dynamically set the data source for SSRS reports without unattended execution account?

后端 未结 1 1623
走了就别回头了
走了就别回头了 2021-01-02 12:55

I need to dynamically specify the data source for SSRS reports at runtime. I found these solutions:

Change SSRS data source of report programmatically in server side

相关标签:
1条回答
  • 2021-01-02 13:38

    Here is how I change a data source at runtime.

    1. Create a report parameter DatabaseServer.
    2. Create a report parameter DatebaseName.
    3. Create a dsTest data source for the report (This is for testing locally).
    4. Set the dsTest data source to point to your test database.
    5. Create another "dsDynamic" data source and set its connection string expression to the following: ="Data Source="+Parameters!DatabaseServer.Value+";Initial Catalog=" + Parameters!DatabaseName.Value

    6. Build and test the report by setting all datasets to the test connection created in step 3.

    7. Set the report's datasets to the dynamic dataset created in step 5 prior to live deployment.
    8. Send in the database name and server name to your reports from your application to point to another database instance.
    0 讨论(0)
提交回复
热议问题