My Account Subscribe Help About
Sign In | Register FREE
Tuesday, April 14, 2026
US blockade of Iranian ports explained in two minutesFormer Nato chief warns UK security 'in peril' as he accuses Starmer of 'corrosive complacency'We will name police and social workers unless action taken, Southport families lawyer saysHouseholds could get free electricity for doing washing on sunny weekendsIan Huntley died from prison attack head injury, inquest hearsChalamet thanked by Royal Ballet and Opera boss for boosting ticket salesGreek police using masked migrants to forcibly push other migrants back across borderWatchdog investigates 11 police officers over handling of Wimbledon school crashWhat's changed since Harry and Meghan last visited Australia in 2018?Sixteen injured after ex-student opens fire at high school in TurkeyJorginho withdraws criticism of Chappell Roan after hotel security incidentLebanon seeks peace, but Hezbollah needs to be convinced firstOil prices ease on hopes of new US-Iran peace talksIsraelis war-weary but most oppose Iran ceasefire, poll suggestsTracking the ships crossing the Strait of HormuzI was minutes from dying - then I heard the lifeboat crewman's voiceOasis among record number of British acts entering Rock & Roll Hall of FameChris Mason: How Lammy and Vance's unlikely friendship is being utilisedAdam Peaty on his return to the pool, LA 2028 and Gordon Ramsay's wedding speechWhy doctors' strikes can actually lead to shorter waiting times and what it costsHospital at centre of child HIV outbreak caught reusing syringes in undercover filmingWhy one school has banned phones for some pupils - but not othersGrand National horse trainer jailed for beating man with hockey stickIrish musician Moya Brennan dies aged 73Welsh Liberal Democrats unveil Senedd election manifestoTeenager charged over Primrose Hill stabbingAl Fayed enablers 'must face accountability', survivors sayRetrial over death of Argentina legend Maradona to beginBBC News appAmericanswers... on 5 Live! Donald Trump vs Pope Leo on Iran
FDN » SQL Server » ADO Connection Strings

ADO Connection Strings

ADO Connection Strings

ActiveX Data Objects (ADO) is the standard data access library for classic ASP and VBScript. This reference covers connection strings for SQL Server, Access, and other data sources.

SQL Server via SQLOLEDB

' SQL Server connection using SQLOLEDB provider
Dim conn
Set conn = Server.CreateObject("ADODB.Connection")

' Windows Authentication (trusted connection)
conn.Open "Provider=SQLOLEDB;" & _
    "Data Source=SQLSERVER01;" & _
    "Initial Catalog=FlamenetDB;" & _
    "Integrated Security=SSPI;"

' SQL Server Authentication
conn.Open "Provider=SQLOLEDB;" & _
    "Data Source=SQLSERVER01;" & _
    "Initial Catalog=FlamenetDB;" & _
    "User ID=appuser;" & _
    "Password=Str0ngP@ss!;"

' Named instance
conn.Open "Provider=SQLOLEDB;" & _
    "Data Source=SQLSERVER01\DEVINSTANCE;" & _
    "Initial Catalog=FlamenetDB;" & _
    "Integrated Security=SSPI;"

SQL Server via ODBC DSN-less

' ODBC driver connection (DSN-less)
conn.Open "Driver={SQL Server};" & _
    "Server=SQLSERVER01;" & _
    "Database=FlamenetDB;" & _
    "Uid=appuser;" & _
    "Pwd=Str0ngP@ss!;"

Microsoft Access (Jet 4.0)

' Access database via Jet provider
conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
    "Data Source=C:\Data\flamenet.mdb;"

' Password-protected Access database
conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
    "Data Source=C:\Data\flamenet.mdb;" & _
    "Jet OLEDB:Database Password=secret;"

Common ADO Pattern (Open, Query, Close)

<%
Dim conn, rs, strSQL
Set conn = Server.CreateObject("ADODB.Connection")
conn.Open "Provider=SQLOLEDB;Data Source=SQLSERVER01;" & _
    "Initial Catalog=FlamenetDB;Integrated Security=SSPI;"

strSQL = "SELECT EmployeeID, FirstName, LastName, Email " & _
    "FROM Employees WHERE DeptID = 3 ORDER BY LastName"
Set rs = conn.Execute(strSQL)

If Not rs.EOF Then
%>
<table border="1">
  <tr><th>ID</th><th>Name</th><th>Email</th></tr>
  <% Do While Not rs.EOF %>
  <tr>
    <td><%= rs("EmployeeID") %></td>
    <td><%= rs("FirstName") & " " & rs("LastName") %></td>
    <td><%= rs("Email") %></td>
  </tr>
  <% rs.MoveNext : Loop %>
</table>
<%
End If
rs.Close : Set rs = Nothing
conn.Close : Set conn = Nothing
%>

Connection Pooling

ADO/OLEDB connections are pooled automatically by the OLEDB provider. To maximize pooling efficiency:

  • Use identical connection strings across your application
  • Close connections as soon as possible (they return to the pool)
  • Do not change connection properties between Open and Close calls
« Back to SQL Server « Back to FDN