'開啟資料庫
Dim Conn
Set Conn=server.createobject("adodb.connection")
Conn.Open ConnStr
%>
<html>
<head>
<title>ASP Test</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body>
<table>
<%
Dim rs, strSQL, Field, strResponse
strSQL = "SELECT EmployeeID,LastName,FirstName FROM Employees;"
Set rs = Conn.Execute(strSQL)
'輸出表頭
strResponse = "<tr>"
For Each Field In rs.Fields
strResponse = strResponse & "<td>" & Field.Name & "</td>"
Next
strResponse = strResponse & "</tr>"
'輸出表體
Do Until rs.EOF
strResponse = strResponse & "<tr>"
For Each Field In rs.Fields
strResponse = strResponse & "<td>" & rs(Field.Name) & "</td>"
Next