首页 > 代码库 > 简单示例

简单示例

<!--#include file = "conn.asp"-->
<%
exec="select * from users"
set rs=server.createobject("adodb.recordset")
rs.open exec,conn,1,1
%>

<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<%do while not rs.eof%><tr>
<td><%=rs("username")%></td>
<td><%=rs("password")%></td>
</tr>
<%
rs.movenext
loop
%>
</table>

<%
rs.close   ‘关闭表
set rs =nothing   ‘销毁表对象
conn.close    ‘关闭数据库
set conn = nothing    ‘销毁数据库对象
%>

 

conn.asp文件

<%
set conn=server.createobject("adodb.connection")
conn.open "driver={microsoft access driver (*.mdb)};dbq="&server.mappath("mypass.mdb")
%>

简单示例