ADO display technology

The most common way to display data from a recordset is to display the data in an HTML table.


Display field names and field values

We have a database called "Northwind" and we want to display data from the "Customers" table (remember to save this file with an .asp extension):

example

<html>
<body>

<%
set conn=Server.CreateObject("ADODB.Connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.Open "c:/webdata/northwind.mdb"

set rs = Server.CreateObject("ADODB.recordset")
rs.Open "SELECT * FROM Customers", conn

do until rs.EOF
  for each x in rs.Fields
    Response.Write(x.name)
    Response.Write(" = ")
    Response.Write(x.value & "<br>")
  next
  Response.Write("<br>")
  rs.MoveNext
loop

rs.close
conn.close
%>

</body>
</html>


Guess you like

Origin blog.csdn.net/shengyin714959/article/details/132017450
ADO