<%@ LANGUAGE = JScript %> Simple ADO Query Simple ADO Query with ASP

Contacts within the Authors Database:

<% var oConn; var oRs; var filePath; // Map authors database to physical path filePath = Server.MapPath("authors.mdb"); // Create ADO Connection Component to connect with // sample database oConn = Server.CreateObject("ADODB.Connection"); oConn.Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" +filePath); // 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.MoveNext(); } %>
<% = oRs(Index)%>
<% oRs.close(); oConn.close(); %>