程序代码:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.>
<html xmlns="http://www.>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>读取数据库</title>
</head>
<body >
<%
'连接数据库
Set Conn=Server.CreateObject("ADODB.Connection")
connstr="provider=microsoft.jet.oledb.4.0;Data source="&Server.MapPath("../Data/xx.mdb")'../Data/xx.mdb为数据库相对路径
Conn.open connstr
set rs=Server.CreateObject("ADODB.RecordSet")
rs.open "select productname from TB_tb_Product ",conn,1 '创建记录集
’循环输出
do while not rs.eof
response.write(rs("productname")+"<br/>")
rs.movenext
loop
rs.close()
set rs=nothing
conn.close()
set conn=nothing
%>
</body>
</html>