ASP and ASP.NET connection strings for Access and MSSQL databases

Programming, error messages and sample code > sample code
1. Access

Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\mydatabase.mdb
Ex:asp
set conn=Server.CreateObject("ADODB.Connection")
conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;data source=c:/webdata/northwind.mdb"
Ex:asp.net
OleDbConnection myConnection = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;data source=c:/webdata/northwind.mdb")
2. Access 2007

Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\myFolder\myAccess2007file.accdb;Persist Security Info=False
3. MSSQL 2008 & 2012
Ex: asp
Driver={SQL Server};Server=;Database=;Uid=;Pwd=;
Ex: asp.net
Server=;Database=;uid=;pwd=;
Ex: :asp
Set conn = Server.CreateObject("ADODB.Connection")

DSNtemp="DRIVER={SQL Server};SERVER=serverURL;UID=username;PWD=pwd;DATABASE=dbname"

conn.open DSNtemp
EX: asp.net
string connectionString = "SERVER=serverURL;UID=username;PWD=pwd;DATABASE=dbname";

SqlConnection connection = new SqlConnection(connectionString);
or Write this into your web.config:
<add 

      name="connectionString"

      connectionString="Server=;Database=;uid=;pwd=;"

      providerName="System.Data.SqlClient" />