天天看点

[实战]ASP show account list

<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>

<em>Version: 1.1 </em>

</body>

</html>

本文转自 bilinyee博客,原文链接:     http://blog.51cto.com/ericfu/1636480   如需转载请自行联系原作者

继续阅读