ASP计数器问题 高手进

来源:百度知道 编辑:UC知道 时间:2024/06/29 01:46:02
<%
dbpath="count/mycount.mdb"
connstr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(""&dbpath&"")
set myconn=server.createobject("adodb.connection")
myconn.open connstr

sub getcount(show)
set rs=myconn.execute("select * from [count] where id= 1 ")
myconn.execute "update count set jishu="&rs("jishu")+1&" where id = 1"
if show then response.write "" & rs("jishu")+1 & ""
rs.close
set rs=nothing
myconn.close
set myconn=nothing
end sub

sub clscount()
myconn.execute("update count set dj=0 where id = 1")
end sub

%>

<%call getcount(1)%>

错误提示是 错误类型:
Microsoft JET Database Engine (0x80040E14)
UPDATE 语句的语法错误。
/mycount.asp, 第 9 行

数据库表是count 计数字段是jishu

求各位高手啦···

你的表名不要取为count,这个单词在数据库里面有特殊含意,最好把表名修改了,全部程序都修改。

当表名为特殊单词,比如为select、update等的时候,各种数据库都有语法规定区分它。比如在MYSQL里面是加上`,你的语句就为update `count` ...。不知道你的数据库是用什么符号,试试看用[]括起来行不行。