%@ LANGUAGE = VBScript %>
<% Option Explicit %>
Simple ADO Query
Simple ADO Query with ASP
Contacts within the Authors Database:
<%
Dim oConn
Dim oRs
Dim curDir
Dim Index
' Map authors database to physical path
curDir = Server.MapPath("\iissamples\sdk\asp\database\authors.mdb")
' Create ADO Connection Component to connect
' with sample database
Set oConn = Server.CreateObject("ADODB.Connection")
oConn.Open "DBQ="& curDir &";Driver={Microsoft Access Driver (*.mdb)};DriverId=25;FIL=MS Access;"
' Execute a SQL query and store the results
' within recordset
Set oRs = oConn.Execute("SELECT * From authors")
%>
<%
Do while (Not oRs.eof) %>
<% For Index=0 to (oRs.fields.count-1) %>
<% = oRs(Index)%> |
<% Next %>
<% oRs.MoveNext
Loop
%>
<%
oRs.close
oConn.close
%>