完整代码是
<%
set conn=server.createobject("adodb.connection")
conn.open "driver={microsoft access driver(*.mdb)}; dbq="&server.mappath
("data/guestbook.mdb");"
%>
<%
exec="select * from guest"
set rs=server.createobject("adodb.recordset")
rs.open exec,conn,1,1
%>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<%do while not rs.eof%><tr>
<td><%=rs("name")%></td>
<td><%=rs("tel")%></td>
<td><%=rs("message")%></td>
<td><%=rs("time")%></td>
</tr><%
rs.movenext
loop
%>
</table>
//下面的三条语句是用于关闭数据库
rs.close
set rs=nothing
conn.close
set conn=nothing
<%
set conn=server.createobject("adodb.connection")
conn.open "driver={microsoft access driver(*.mdb)}; dbq="&server.mappath("data/guestbook.mdb");"
%>
改成
<%
set conn=server.createobject("adodb.connection")
conn.open "driver={microsoft access driver (*.mdb)};dbq="&server.mappath("database/db.mdb")
%>
上面结尾处多了;"
driver和(*.mdb)之间少了一个空格
楼主应该在学十天,给你个参考
我测试时忘了把数据库更改了
<%
set conn=server.createobject("adodb.connection")
conn.open "driver={microsoft access driver (*.mdb)};dbq="&server.mappath("database/db.mdb")
%>
改成
<%
set conn=server.createobject("adodb.connection")
conn.open "driver={microsoft access driver (*.mdb)};dbq="&server.mappath("data/guestbook.mdb")
%>
这里上面写错了。