Tuesday, March 27, 2012

dataSource is different instance of same database(Urgent)

Hi,

I need help......

I am trying to create a report whose datasource will be different instances of the same database.So both the databases contains the same tables with same schema but the thing is that teh data is different.I have to collect the daat from different instances of the same table a(as they contains different different data) and using the collection to generate the report.

It's very very urgent ...plz reply ...

Thanx in advance

HI,

I dont thnk this is possible to do(as far as i know you cant connect a datasource to different database at runtime and also you cant change datasource at runtime). Now to solve your problem i can think of these solutions -

1. Create two datasources(connecting to two different database), and in your report create two datasets connecting to each one of the datasources. Similarly create two instances of tables (or whatever control you want to display) and connect controls to dataets. Now on runtime show/hide the table based on data from which table you want to show.

This is not a verygood choice(actually very poor) and you can achieve this using two copies of same report connecting to different databases and by showing the appropriate report to user.

2. Better approch is to have two tables in the same database like a_1 and a_2 and pass a parametre to your sp specifying which table to be used. In SP you will have to create dynamic sql in which table name will be created based on the parametre passed.

Hope i am able to convey whats there in my mind....

|||

Just came across this blog, it looks like we can dynamically change the connection string(did'nt tried though) -

http://blogs.msdn.com/bimusings/archive/2006/07/20/673051.aspx