写连接ACCESS数据库连接ASP,再取数据库中的信息以表格形式显示在网页上

2024-12-22 22:14:15
推荐回答(1个)
回答1:

需要在book.mdb建立一个表叫table1
两个字段
id 数字型 自增加
name varchar(100)
<%
Dim conn
set conn=server.createobject("ADODB.connection")
conn.connectionstring="Provider=microsoft.JET.OLEDB.4.0;" &_
"data source=" & server.mappath("BOOK.MDB")
conn.open
sql="select * from table1"
set rs=server.createobject("ADODB.Recordset")
rs.open sql,conn,1,2,1

response.write "

"
do while not rs.eof
response.write ""
response.write ""
response.write ""
response.write ""
rs.movenext
loop
response.write "
" & rs("id") & "" & rs("name") &
"

conn.close
set conn = nothing
%>

将db和这个asp文件放在一起,运行asp文件就可以了,IIS那些你懂的吧