Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

A DB Connection question

Status
Not open for further replies.

chispavip

IS-IT--Management
Dec 20, 2006
10
MX
A good programming technique is not to leave a static connection string, because it could be modified dynamically, and this way we void re-compile the code with the new string.

The problem merge when we use some wizards, the components ask for a connection and it should be done in a static way, so my questions is:

How can I change my connection string of my datasource if I created using the wizards?
 
what is the "wizard"? it sounds like your using a 3rd party app to generate code based on a db. Much like an OR Mapper. or generating strongly typed dataset.

you want to map the connection string to the app.config file (or web.config if it's an asp.net project). this will allow you to change the connection string without re-compiling the code.

if your using .net 2.0 you can encrypt the connection string so others cannot read the information in the config file.

if your not using 2.0 you'll either need to hard code the values in the system, or store the data in the registry.(this is what MS recommends for security, but i've never gone that far).

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top