Friday, March 9, 2012

How to deploy an report and connection string from some xml file

Suppose we are two developer.Who have SSRS install at there own system.
Our database server is intalled on our main db server.

1,First thing does it necessay to create a shared datasource.
I have a web application in which I want's to add a folder say My reports in which i will put my reports {that is .rdl file}
Then I want's to hit a url with render format as excel this will bring down my report in excel format.

2,How to configure a connection
I want's to pass the connection string in the rdl via some xml file let say myconnectionn xml file
which look like
<connection-sources>
<source name="Mycon1" default="true" >
Data Source=abc\yukon;User ID=sa;Password=as;Initial Catalog=MyDbName1
</source>
<source name="Mycon2" skip="true" >
Data Source=asdsadabc\yukon;User ID=sa;Password=as;Initial Catalog=MyDbName2
</source>
</connection-sources>

connection string would be where attribute default of source should be true.

1. Shared data sources are used to define a connection once, and share it among multiple reports. That way, if the connection information changes, you only have to update the shared data source, and not each report. You don't have to use shared data sources, though. Data sources can be defined at a report level as well.

2. You can create a connection string from an expression, which would allow you to change the connect string at runtime based on parameters passed to the report. However, as far as I am aware, you cannot use an XML file directly to set the connect string.

|||

Thanks jwelch.

Then any work around ?

|||Use an expression based connection and pass your connection string (or components of it) in as parameters.|||

What is an expression based connection and how can I pass my connection string (or components of it) in as parameters.

Please let it clear a little bit ?

|||

You can create an expression based connection by going to the data tab of your report. Open up the dataset properties (by clicking the ellipsis (...) beside the dataset dropdown), and then click the ellipsis next to the data source. If the Use shared reference option is checked, uncheck it. You should then be able to select the fx button next to the connection string box. You can enter an expression into the resulting dialog, such as:

Dynamic Connection String

="Data Source="+Parameters!Server.Value+";Initial Catalog="+Parameters!Database.Value

You'll need to create the parameters on the report to hold the values you want, and you may need to alter the connection string in my example to match your database provider.

Hope this helps.

No comments:

Post a Comment