PDA

Click to See Complete Forum and Search --> : Change database source via code


martell
Apr 13th, 2007, 02:21 AM
dear all,

i have a problem with my vb application,i have 2 similar database but i use one application.
so can i change the database source on crystal report by using vb code?
i use SQL server database and use Dsn for the connection string..
example:

i log on to my application using database A and i open my report using that database.
but when i log in again using database B and i open my report,it's still use database A.anyone can help me?
thanks alot

NB: sorry my english is very bad. ;)

best regards

martell

Dnereb
Apr 13th, 2007, 02:52 AM
Changing the connection (close and open with a new connection string) to the apropriate DB should be enough (if they are truly similar in structure)

If you're using a ADODC you can change it's connection as well by
closing it and reopening with the other connection string.

You should focus on the connection used by your report.

martell
Apr 15th, 2007, 09:29 PM
do u knoe how to change the database via code in the report?

use this (report.Database.SetDataSource) ????
thanks