View Single Post
  #2 (permalink)  
Old January 6th, 2006, 09:47 AM
planoie's Avatar
planoie planoie is offline
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

1. Most recommend you put the connection string in the web.config file:

<appSettings file="user.config">
  <add key="CONNSTRING" value="<your connection string here>" />
</appSettings>

2. Retrieve it using System.Configuration.ConfigurationSettings:
C#: System.Configuration.ConfigurationSettings.AppSett ings["CONNSTRING"]
VB: System.Configuration.ConfigurationSettings.AppSett ings("CONNSTRING")

3. Avoid using them. A properly designed application shouldn't need them. What would you intend to use them for? There may be better solutions depending on what you want to do.

-Peter