• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 141
  • Last Modified:

connection info in the configuration file

hi

where to store the connection info in the configuration file of a project and how to read it ?
0
Pure_Heart
Asked:
Pure_Heart
  • 2
1 Solution
 
DhaestCommented:
Read connection string from web.config
http://snippets.dzone.com/posts/show/1343

Custom Configuration SQL Connection String Section
http://www.codeproject.com/KB/database/CustomConfigSqlConn.aspx
0
 
DhaestCommented:
In your app.config
<configuration>
<appSettings>
      <add key="connectionString" value="server=servername;database=dbname;integrated security=sspi" />
 
</appSettings>
</configuration>


To reference that in your code:

Dim oConn As New SqlConnection(ConfigurationSettings.AppSettings("connectionString"))
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now