Link to home
Start Free TrialLog in
Avatar of srinivas_vemla
srinivas_vemla

asked on

C# .Net 1.1 DAAB - Connecting using ConnectionString and not Configuration File

I am using C# .Net 1.1 Data Access Application Block from Enterprise Library. Till today I was fine with using it and specifying my connection details in a Configuration file. But a new requirement came that the Connection String should be specified from the Database and not a file. But in DAAB, I don't see a method that takes a connection string as a parameter and gets me a connection.

Am I missing something? How can I implement Connection String way of connecting using DAAB without too many changes?
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

Now, that doesn't sound like a very smart decision, but whatever!!  How can you connect to a database to get the connection for the same database (doesn't make any sense)?

Bob
Avatar of srinivas_vemla
srinivas_vemla

ASKER

No They these two are different databases. One database will have connection strings that I should be using. I will set the connection string for this database in the config file.

But a table in this database will have connection strings for all other databases and some other settings. I should be using these entries to connect to them.

I hope I am clear this time.
Ok, that sounds a little better--that is something that you can achieve.  Use the connection string, and ExecuteScalar to execute a query and get the connection string back to the other database.

Bob
So if I get a connection and change it's connection string to something else, it will automatically connect to the other database? Is that all needed?
ASKER CERTIFIED SOLUTION
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial