%@ Language=VBScript %> <% option explicit dim sql sql = request.form("sql") if sql = "" then sql = "select * from students;" sql = trim(sql) %>
Query is... " & sql & "
") rs.Open sql, conn, 1, 1 if err.description = "" then dim fcount 'following pulls the number of fields out of the recordset... fcount = rs.fields.count response.write ("
Total Fields: " & fcount) dim rcount 'following gets the number of records... rcount = rs.recordcount 'now put the info in the presentation... response.write ("
Total Records: " & rcount) dim i do while not rs.eof response.write ("
--------------New Record------------
")
'here we use the recordcount in for-next loop
'note that arrays tend to be 0 referenced
for i = 0 to rs.fields.count - 1
response.write (rs.fields(i).name)
response.write (" --- ")
Response.Write (rs.fields(i).value)
response.write ("
")
'Close the loop iterating records
next
rs.MoveNext
loop
else
response.write("Error in the query: " & err.description & "")
end if
rs.Close
else
if sql <> "" then response.write("