Home
Manage Your Code
Snippet: Web.Config Database Connection Strings (ASP.NET)
Title: Web.Config Database Connection Strings Language: ASP.NET
Description: I can never rember these when I need them. Views: 1185
Author: Jason Lindstrom Date Added: 4/17/2008
Copy Code  
<!-- WEB.CONFIG CONNECTION STRINGS -->
<!-- ORACLE -->
<add name="OracleConnectionString" connectionString="data source=[database name];user id=[username];password=[password];" providerName="System.Data.OracleClient"/>
<!-- SQL -->
<add name="SqlConnectionString" connectionString="Data Source=[database name];Initial Catalog=[database name];Persist Security Info=True;User ID=[username];Password=[password]" providerName="System.Data.SqlClient"/>
<!-- SQL EXPRESS -->
<add name="SqlExpressConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\[database filename].mdf;Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient"/>
Usage