代码如下:
<html>
<head>
<title>
</title>
<%
set conn = server.CreateObject("adodb.connection")
conn.connectionstring = "provider=microsoft.jet.oledb.4.0;data source="&server.MapPath("testAsp/dataBase/myDb.mdb")
set rs=server.CreateObject("ADODB.Recordset")
sql="select name from student "
rs.open sql,conn,1,1
while not rs.eof
response.write("<br>"&rs("student"))
rs.movenext
wend
%>
<%
conn.close
set conn=nothing
%>
%>
</head>
<body>
</body>
</html>
<html>
<head>
<title>
</title>
<%
set conn = server.CreateObject("adodb.connection")
conn.connectionstring = "provider=microsoft.jet.oledb.4.0;data source="&server.MapPath("testAsp/dataBase/myDb.mdb")
set rs=server.CreateObject("ADODB.Recordset")
sql="select name from student "
rs.open sql,conn,1,1
while not rs.eof
response.write("<br>"&rs("student"))
rs.movenext
wend
%>
<%
conn.close
set conn=nothing
%>
%>
</head>
<body>
</body>
</html>
<html>
<head>
<title>
</title>
<%
set conn = server.CreateObject("adodb.connection")
conn.connectionstring = "provider=microsoft.jet.oledb.4.0;data source="&server.MapPath("testAsp/dataBase/myDb.mdb")
set rs=server.CreateObject("ADODB.Recordset")
sql="select name from student "
rs.open sql,conn,1,1
while not rs.eof
response.write("<br>"&rs("student"))
rs.movenext
wend
%>
<%
conn.close
set conn=nothing
%>
%>
</head>
<body>
</body>
</html>
最后报错是:
错误类型:ADODB.Recordset (0x800A0E7D)
连接无法用于执行此操作。在此上下文中它可能已被关闭或无效。
/asp/显示数据库.asp, 第 13 行
那位高手帮我看看哪里出错了啊,到底?