Connection String Opinion?

  • Thread starter Thread starter Brett Wickard
  • Start date Start date
B

Brett Wickard

I'm having a design brain-cramp.

I have an app that needs to have a connection string that can changed by the
user.... (basically the same app needs to be able to talk to different
databases on different servers --- they all have -identical- tables/views/sp
within them)

So, it seems like I would want to make a "database"form and have a
connection string as a property... But as I do this, I feel I'm swimming
upstream all the time so to speak --- everything seems to want to use a
connectiong string from app.config.

Do you have any ideas on how I should handle this? It seems like I can't
use the design time UI much if I keep going the way I'm going (like for grid
design and such)...

TIA!
 
I use the app.config for all my projects. This works out well for
development. If I change my test database I can just edit the app.config
and everything works with the new path.

That being said I don't use the app.config for my application in the field.
First time I tried to explain editing the app.config to a customer I relized
it was way not acceptable.

So my solution is to store all the database path parts in the reg and allow
the user to edit them from a data source form. I then place a function in
all my forms initialize function that calls the database string builder.
 
Sorry, last one few away before finishing.

I use the app.config for all my projects. This works out well for
development. If I change my test database I can just edit the app.config
and everything works with the new path.

That being said I don't use the app.config for my application in the field.
First time I tried to explain editing the app.config to a customer I
realized
it was way not acceptable.

So my solution is to store all the database path parts in the reg and allow
the user to edit them from a data source form. I then place a function in
all my forms initialize function that calls the database string builder.

....ConnectionString = MyClass.GetConnetionString();

..NET 2 has the option to store the data in a application file but each time
you change your application version then user has to reset the database
path. They also have better ways of reading / writing the data for what its
worth.

Regards,
John
 
Back
Top