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