%@ LANGUAGE = JScript %>
Simple ADO Query
Simple ADO Query with ASP
Contacts within the Authors Database:
<%
var oConn;
var oRs;
var curDir;
// Map authors database to physical path
curDir = Server.MapPath("\\iissamples\\sdk\\asp\\database\\authors.mdb");
// Create ADO Connection Component to connect with
// sample database
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
oRs = oConn.Execute("SELECT * From authors");
%>
<%
while (!oRs.eof) { %>
<% for(Index=0; Index < (oRs.fields.count); Index++) { %>
<% = oRs(Index)%> |
<% } %>
<% oRs.MoveNext();
}
%>
<%
oRs.close();
oConn.close();
%>