Loop through and list records from a database with classic ASP

A basic example showing how to loop through records in a database using classic ASP.

Dim strDbConnection
Dim objConn
Dim objRS
Dim strSQL
strDbConnection = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=d:\test.mdb;"
Set objConn = Server.CreateObject("ADODB.Connection")
strSQL = "SELECT fullName, birthDate FROM persons"
Set objRS = objConn.Execute(strSQL)
If objRS.EOF Then
  Response.Write("No items found")
  Do While Not objRS.EOF
    Response.Write(objRS.Fields("birthDate").value & ", ")
    Response.Write(objRS.Fields("fullName").value & "<br />")
End If
Set objRS = Nothing
Set objConn = Nothing



RSS 2.0 feed All content
RSS 2.0 feed ajax
RSS 2.0 feed asp
RSS 2.0 feed aspnet
RSS 2.0 feed bicycle
RSS 2.0 feed copenhagen
RSS 2.0 feed databases
RSS 2.0 feed denmark
RSS 2.0 feed diy
RSS 2.0 feed dotnet
RSS 2.0 feed html
RSS 2.0 feed japan
RSS 2.0 feed javascript
RSS 2.0 feed modding
RSS 2.0 feed photography
RSS 2.0 feed utilities
RSS 2.0 feed vbscript