473,320 Members | 2,097 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Connection String Opinion?

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!

Dec 16 '05 #1
2 1189
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.

"Brett Wickard" <br**********@nospam.nospam> wrote in message
news:O2*************@TK2MSFTNGP12.phx.gbl...
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!

Dec 16 '05 #2
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

"Brett Wickard" <br**********@nospam.nospam> wrote in message
news:O2*************@TK2MSFTNGP12.phx.gbl...
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!

Dec 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: H | last post by:
This is a question that has haunted me for quite some time. if you build a 4 tier database application where the 4th tier is the database server (MS SQL 2000), where do you build the connection...
3
by: Tyson Marchuk | last post by:
Hello, Background info Kind of new to using databases and I'm writing an app in C# which connects to a MySQL database. I was using the ODBC connector and a DSN entry to connect to the database...
4
by: A.M | last post by:
Hi, I have an encrypted database connection string stored in web.config file and i need to have the connection string several times in my application. What would be the best way to have that...
5
by: Fernando Lopes | last post by:
Hi there. In your opinion, where is the best place to put the connection string of a web application? Web.config, a constant into the code? I'm not using a component server, so it's not an...
4
by: Rahul Anand | last post by:
Getting SQL Exception when trying to implement Connection based Trasaction using SQL Helper class. I am using the follwing function to execute my stored procs: -=-=-=- ExecuteScalar(ByVal...
37
by: sam44 | last post by:
Hi, At startup the user log on and chooses the name of a client from a dropdownlist, which then changes dynamically the connection string (the name of the client indicates which database to use)....
14
by: martin1 | last post by:
All, I want to check wether db connection/open or not, if not it will post db connection error to user in message box The code is like: Dim objConnection As New SqlConnection _...
9
by: =?Utf-8?B?Vmlua2k=?= | last post by:
Hello Everyone, I have a question about storing the connection strings to the database in a config file or database. My manager wants me to store all the connection strings in a database, but I...
4
by: laziers | last post by:
Hi there Anybody knows what is the best way to manage creation 2000 of the database connections at the same time? Now Im doing it somethink like this: using ( Connection conn =...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.