?
Solved

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

Posted on 2007-10-19
5
Medium Priority
?
1,448 Views
Last Modified: 2013-12-17
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?
0
Comment
Question by:srinivas_vemla
  • 3
  • 2
5 Comments
 
LVL 96

Expert Comment

by:Bob Learned
ID: 20109990
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
0
 

Author Comment

by:srinivas_vemla
ID: 20110107
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.
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 20110134
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
0
 

Author Comment

by:srinivas_vemla
ID: 20110258
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?
0
 
LVL 96

Accepted Solution

by:
Bob Learned earned 2000 total points
ID: 20110506
This is a little Enterprise Library review, since I don't use it.  The DatabaseFactory.CreateDatabase doesn't have a way of specifying a connection string that isn't in the configuration file.

Bob
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses
Course of the Month13 days, 14 hours left to enroll

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question