紧急求助,请看看这段代码,是否有问题?(IE提示10行有错误)(在线等待)

20010101cz 2003-09-11 08:33:28
<%
set cn= Server.CreateObject("ADODB.Connection")
cn.mode=adModeReadWrite
Cn.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & server.mappath("./update/PageUpdata.mdb")

dim rs,sql,n
'set rs1 = Server.CreateObject("ADODB.Recordset")
sql="update xxtbl set Count=Count+1 where Id=" & request("Id")
cn.execute(sql)

sql = "Select * from xxtbl where Id=" & request("Id") & " order by Id desc"
'rs1.open sql, cn
set rs=cn.execute(sql)
'virtual
%>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title><%=rs("Title")%></title>
</head>
<body leftmargin=0 topmargin=0 >
<!--#include file="top.htm"-->
<div align="center">
<center>
<table border="0" cellpadding="0" cellspacing="0" width="660" >
<tr>
<td width="660" height="34"><br><center>标题:<font color=blue><%=rs("Title")%></font></center><hr></td>
</tr>
<tr>
<td width="660" align="left" >   <font size="2"><%=rs("Text1")%></font><p><p><p><p></td>
</tr>
</table>
</center>
</div>
<p></p>
<!--#include file="bottom.htm"-->
</body>

</html>

出错信息如下:

HTTP 500.100 - 内部服务器错误 - ASP 错误
Internet 信息服务

--------------------------------------------------------------------------------

技术信息(适用于支持人员)

错误类型:
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
/Text1.asp, 第 9 行


浏览器类型:
Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)

页:
GET /Text1.asp

时间:
2003年9月11日, 8:09:34


详细信息:
Microsoft 支持



...全文
71 10 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
yangsm 2003-09-11
  • 打赏
  • 举报
回复
注意传过来的ID是否为空,还是数据库的路径改为相对路径试试。("../databae/xx.mdb")
billyqiao 2003-09-11
  • 打赏
  • 举报
回复
sql="update xxtbl set Count=Count+1 where Id=" & request("Id")这句有问题
如果count是整型字段,id是整型,则用
sql="update xxtbl set Count=Count+1 where Id=" & cint(request("Id"))
如果count是整型字段,id是字符,则用
sql="update xxtbl set Count=Count+1 where Id='" & request("Id") & "'"
另外,用count来做字段名不妥,它本身就是SQL的关键字


奇玉 2003-09-11
  • 打赏
  • 举报
回复
sql="update xxtbl set Count=Count+1 where Id='"&request("Id")&"'"
这样准行
zjg791015 2003-09-11
  • 打赏
  • 举报
回复
如果你的数据库字段类型是整型的,建议你把传递过来的参数也格式化成整型的,可以这样来:
sql="update xxtbl set Count=Count+1 where Id=" & Int(request("Id"))
celerylhl 2003-09-11
  • 打赏
  • 举报
回复
dim rs,sql,n
'set rs1 = Server.CreateObject("ADODB.Recordset")

if not len(request("id")>0) then '用这句调试一下看看
response.write("ID值没有传过来!")
response.end
end if

sql="update xxtbl set Count=Count+1 where Id=" & request("Id")
cn.execute(sql)
Tal 2003-09-11
  • 打赏
  • 举报
回复
sql = "Select * from xxtbl where Id=" & request("Id") & " order by Id desc"
改为
sql = "Select * from xxtbl where Id='" & request("Id") & "' order by Id desc"
试试
shauykee 2003-09-11
  • 打赏
  • 举报
回复
gq(游子) 说的很对,请注意你的SQL语句的正确性和完整性!!
gq 2003-09-11
  • 打赏
  • 举报
回复
你没有判断request("Id")是否为空.当request("Id")为空的时候,你的SQL语句都是有问题的..或者request("Id"):它应该是整型的吧? 当你传过来的request("Id")不是整型时..你的sql语句执行的时候都会出现问题.
liaijian 2003-09-11
  • 打赏
  • 举报
回复
DBQ=" & server.mappath("./update/PageUpdata.mdb")
数据库路径好象有点问题吧?
tigerwen01 2003-09-11
  • 打赏
  • 举报
回复
sql="update xxtbl set Count=cint(Count+1) where Id=" & request("Id")

28,409

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧