注册 登录
编程论坛 ASP技术论坛

为什么老TIMEOUT啊

三哥 发布于 2010-04-15 11:14, 596 次点击
以下是我的代码,忘哪位兄弟帮忙解决下!本页面名称untitled.asp数据库cool.mdb表单名book!忘兄弟姐妹们指点迷津!谢谢!
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!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=gb2312" />
<title>无标题文档</title>
</head>

<body>
<form method="post" name="form1" action="untitled.asp">
name<input type="text" name="name" /><br />
tel<input type="text" name="tel" /><br />
message<input type="text" name="message" value="" /><br>
<input type="submit" name="submit1" value="提交" />
<input type="reset" name="submit2" value="重置" />
</form>
<%
dim conn,db
dim connstr
db="local/cool.mdb" '数据库文件位置
on error resume next
connstr="DBQ="+server.mappath(""&db&"")+";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"
set conn=server.createobject("ADODB.CONNECTION")
if err then
err.clear
else
conn.open connstr
end if
sub CloseConn()
    conn.close
    set conn=nothing
end sub
%>
<%
exec="select * from book"
set rs=server.createobject("adodb.recordset")
rs.open exec,conn,1,1
%>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<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>
</body>
</html>


[ 本帖最后由 三哥 于 2010-4-15 11:15 编辑 ]
5 回复
#2
yms1232010-04-15 11:20
on error resume next
把这句去了,看看哪出的错误。
<%do until rs.eof%><tr>
<td><%=rs("name")%></td>
<td><%=rs("tel")%></td>
<td><%=rs("message")%></td>
<td><%=rs("time")%></td>
</tr><%
rs.movenext
loop
#3
三哥2010-04-15 11:25
回复 2楼 yms123
去掉后,Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Microsoft][ODBC Microsoft Access Driver]常见错误 不能打开注册表关键字 'Temporary (volatile) Jet DSN for process 0xabc Thread 0xb0c DBC 0x26bd024 Jet'。
/host/untitled.asp, 第 27 行
这个错误啊
#4
yms1232010-04-15 11:30
connstr="DBQ="+server.mappath(""&db&"")+";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"
连接字符串问题换连接字符串
constr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&Server.MapPath("&db&")&";Persist Security Info=False"
#5
三哥2010-04-15 11:45
回复 4楼 yms123
还是OUT,是不是我模块不对呢
#6
三哥2010-04-15 11:49
哦了,谢谢各位了,我解决了!<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!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=gb2312" />
<title>无标题文档</title>
</head>

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

<%
dim exec
exec="select * from book"
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>
</tr><%
rs.movenext
loop
%>
</table>
</body>
</html>
1