<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>PO2 Account List</title>
</head>
<body>
<h2 align = center >PO2 Account List</h2>
<hr>
<%
dbpath=server.mappath("Account.accdb")
‘response.write dbpath
set connread=server.createobject("adodb.connection")
connread.open "provider=Microsoft.ACE.OLEDB.12.0;data source="&dbpath
exec="select*from AccountList"
set rsread=server.createobject("adodb.recordset")
rsread.open exec,connread,1,1
if connread.Errors.Count > 0 then
for i = 1 to connread.Errors.Count
set err=connread.Errors.Item(i-1)
response.write err.Number & err.Description
Next
end if
%>
<table width="100%" bgcolor="#fff5ee">
<tr>
<%for each x in rsread.Fields
response.write("<th align=‘middle‘ bgcolor=‘#b0c4de‘>" & x.name & "</th>")
next
%>
</tr>
<%do until rsread.EOF%>
<tr>
<%for each x in rsread.Fields %>
<td align = ‘middle‘><%Response.Write(x.value)%></td>
<%next
rsread.MoveNext
%>
</tr>
<%loop
rsread.close
connread.close
set connread =nothing
set rsread = nothing
%>
</table>
<hr>
<em>Version: 1.1 </em>
</body>
</html>
本文出自 “Eric的心路旅程” 博客,谢绝转载!
原文:http://ericfu.blog.51cto.com/416760/1636480