帮我看看这个计数器代码哪错了,怎么改 悬50分

来源:百度知道 编辑:UC知道 时间:2024/06/17 23:17:26
<%
set conn=server.createobject("adodb.connection")
connstr="Provider=Microsoft.jet.oledb.4.0;data source="&server.mappath("cou.mdb") //cou是数据库名
conn.open connstr
if session("visited")<>"yes" then
application.Lock()
conn.execute("update counter set hits=hits+1 where kid=1") //counter是数据库里面用于存储数据的表名
application.UnLock()
session("visited")="yes"
end if
set rs=conn.execute("select * from kuo where kid=1")
if rs.eof and rs.bof then
counters=0
else
counters=rs("hits")
end if
rs.close
conn.close
set rs=nothing
set conn=nothing
%>

应该是 conn.execute("update counter set hits=hits+1 where kid=1") 这里, 但是看不懂哪错诶
<%
//先建一个表counter,字段hits(int),并插入一条数据hits=0
set conn=server.createobject("adodb.connection")
conn

把错误提示粘上来看看~
试试
conn.execute("update [counter] set [hits]=[hits]+1 where [kid]=1")

kid?有这个字段么?

你再看看你的字段是不是都是数字。。?