Hello,
Our customers often have 2 or more databases with the same structure.
How can we pass the database as a parameter at runtime in Reporting Services
2005?
Thank you,
LoreacaIn 2005 you will be able to have dynamic datasources. From 2005 help:
Data Source Expressions
You can put an expression into a connection string to allow users to select
the data source at run time. For example, suppose a multinational firm has
data servers in several countries. With an expression-based connection
string, a user who is running a sales report can select a data source for a
particular country before running the report.
The following example illustrates the use of a data source expression in a
SQL Server connection string. The example assumes you have created a report
parameter named ServerName:
Copy Code
="data source=" &Parameters!ServerName.Value & ";initial
catalog=AdventureWorks
Data source expressions are processed at run time or when a report is
previewed. The expression must be written in Visual Basic. Use the following
guidelines when defining a data source expression:
>>>>>>>>
Design the report using a static connection string. A static connection
string refers to a connection string that is not set through an expression
(for example, when you follow the steps for creating a report-specific or
shared data source, you are defining a static connection string). Using a
static connection string allows you to connect to the data source in Report
Designer so that you can get the query results you need to create the
report.
When defining the data source connection, do not use a shared data source.
You cannot use a data source expression in a shared data source. You must
define a report-specific data source for the report.
Specify credentials separately from the connection string. You can use
stored credentials, prompted credentials, or integrated security.
Add a report parameter to specify a data source. For parameter values, you
can either provide a static list of available values (in this case, the
available values should be data sources you can use with the report) or
define a query that retrieves a list of data sources at run time.
Be sure that the list of data sources share the same database schema. All
report design begins with schema information. If there is a mismatch between
the schema used to define the report and the actual schema used by the
report at run time, the report might not run.
Before publishing the report, replace the static connection string with an
expression. Wait until you are finished designing the report before you
replace the static connection string with an expression. Once you use an
expression, you cannot execute the query in Report Designer. Furthermore,
the field list in the Datasets window and the Parameters list will not
update automatically.
>>>>>>>
--
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"Lori" <lhaiducescu@.seniorsoftware.ro> wrote in message
news:eXsv4cceGHA.1324@.TK2MSFTNGP04.phx.gbl...
> Hello,
> Our customers often have 2 or more databases with the same structure.
> How can we pass the database as a parameter at runtime in Reporting
> Services 2005?
> Thank you,
> Loreaca
>|||Perfect.
Thank you!
"Bruce L-C [MVP]" <bruce_lcNOSPAM@.hotmail.com> wrote in message
news:eUgGHreeGHA.1320@.TK2MSFTNGP04.phx.gbl...
> In 2005 you will be able to have dynamic datasources. From 2005 help:
> Data Source Expressions
> You can put an expression into a connection string to allow users to
> select the data source at run time. For example, suppose a multinational
> firm has data servers in several countries. With an expression-based
> connection string, a user who is running a sales report can select a data
> source for a particular country before running the report.
> The following example illustrates the use of a data source expression in a
> SQL Server connection string. The example assumes you have created a
> report parameter named ServerName:
> Copy Code
> ="data source=" &Parameters!ServerName.Value & ";initial
> catalog=AdventureWorks
>
>
> Data source expressions are processed at run time or when a report is
> previewed. The expression must be written in Visual Basic. Use the
> following guidelines when defining a data source expression:
>>>>>>>>
> Design the report using a static connection string. A static connection
> string refers to a connection string that is not set through an expression
> (for example, when you follow the steps for creating a report-specific or
> shared data source, you are defining a static connection string). Using a
> static connection string allows you to connect to the data source in
> Report Designer so that you can get the query results you need to create
> the report.
> When defining the data source connection, do not use a shared data source.
> You cannot use a data source expression in a shared data source. You must
> define a report-specific data source for the report.
> Specify credentials separately from the connection string. You can use
> stored credentials, prompted credentials, or integrated security.
> Add a report parameter to specify a data source. For parameter values, you
> can either provide a static list of available values (in this case, the
> available values should be data sources you can use with the report) or
> define a query that retrieves a list of data sources at run time.
> Be sure that the list of data sources share the same database schema. All
> report design begins with schema information. If there is a mismatch
> between the schema used to define the report and the actual schema used by
> the report at run time, the report might not run.
> Before publishing the report, replace the static connection string with an
> expression. Wait until you are finished designing the report before you
> replace the static connection string with an expression. Once you use an
> expression, you cannot execute the query in Report Designer. Furthermore,
> the field list in the Datasets window and the Parameters list will not
> update automatically.
>>>>>>>
> --
> Bruce Loehle-Conger
> MVP SQL Server Reporting Services
> "Lori" <lhaiducescu@.seniorsoftware.ro> wrote in message
> news:eXsv4cceGHA.1324@.TK2MSFTNGP04.phx.gbl...
>> Hello,
>> Our customers often have 2 or more databases with the same structure.
>> How can we pass the database as a parameter at runtime in Reporting
>> Services 2005?
>> Thank you,
>> Loreaca
>
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment