在线等 [Microsoft][ODBC Microsoft Access 驱动程序] 语法错误 (操作符丢失) 在查询表达式 'ID =' 中。
部分代码如下求高手解答<%setcmdhits=Server.CreateObject("ADODB.Command")cmdhits.ActiveConnection=...
部分代码如下 求高手解答
<%
set cmdhits = Server.CreateObject("ADODB.Command")
cmdhits.ActiveConnection = MM_conn_STRING
cmdhits.CommandText = "UPDATE fx SET hits = hits + 1 WHERE ID = " + Replace(cmdhits__hitID, "'", "''") + " "
cmdhits.CommandType = 1
cmdhits.CommandTimeout = 0
cmdhits.Prepared = true
cmdhits.Execute()
%> 展开
<%
set cmdhits = Server.CreateObject("ADODB.Command")
cmdhits.ActiveConnection = MM_conn_STRING
cmdhits.CommandText = "UPDATE fx SET hits = hits + 1 WHERE ID = " + Replace(cmdhits__hitID, "'", "''") + " "
cmdhits.CommandType = 1
cmdhits.CommandTimeout = 0
cmdhits.Prepared = true
cmdhits.Execute()
%> 展开
4个回答
展开全部
<%
if cmdhits__hitID="" or cmdhits__hitID=null then
cmdhits__hitID=0
end if
set cmdhits = Server.CreateObject("ADODB.Command")
cmdhits.ActiveConnection = MM_conn_STRING
cmdhits.CommandText = "UPDATE fx SET hits = hits + 1 WHERE ID = " + cmdhits__hitID
cmdhits.CommandType = 1
cmdhits.CommandTimeout = 0
cmdhits.Prepared = true
cmdhits.Execute()
%>
if cmdhits__hitID="" or cmdhits__hitID=null then
cmdhits__hitID=0
end if
set cmdhits = Server.CreateObject("ADODB.Command")
cmdhits.ActiveConnection = MM_conn_STRING
cmdhits.CommandText = "UPDATE fx SET hits = hits + 1 WHERE ID = " + cmdhits__hitID
cmdhits.CommandType = 1
cmdhits.CommandTimeout = 0
cmdhits.Prepared = true
cmdhits.Execute()
%>
追问
按你的改了 出现了这个
类型不匹配: '[string: "UPDATE fx SET hits "]'
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
cmdhits.CommandText = "UPDATE fx SET hits = hits + 1 WHERE ID = " + Replace(cmdhits__hitID, "'", "''") + " "
hits应该是数字吧,那么这样写试试:hits="&cint(hits+1)&"
hits应该是数字吧,那么这样写试试:hits="&cint(hits+1)&"
追问
你好 能给个完整的么 不知道具体改怎么改哈
谢啦哈
追答
cmdhits.CommandText = "UPDATE fx SET hits = hits + 1 WHERE ID = " + Replace(cmdhits__hitID, "'", "''") + " "
改成:cmdhits.CommandText = "UPDATE fx SET hits = "&hits + 1&" WHERE ID = " + Replace(cmdhits__hitID, "'", "''") + " "
或:
hits=hits+1
cmdhits.CommandText = "UPDATE fx SET hits = "&cint(hits)&" WHERE ID = " + Replace(cmdhits__hitID, "'", "''") + " "
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
<%
set cmdhits = Server.CreateObject("ADODB.Command")
cmdhits.ActiveConnection = MM_conn_STRING
cmdhits.CommandText = "UPDATE fx SET hits = hits + 1 WHERE ID ="+cmdhits__hitID
cmdhits.CommandType = 3
cmdhits.CommandTimeout = 0
cmdhits.Prepared = true
cmdhits.Execute()
%>
set cmdhits = Server.CreateObject("ADODB.Command")
cmdhits.ActiveConnection = MM_conn_STRING
cmdhits.CommandText = "UPDATE fx SET hits = hits + 1 WHERE ID ="+cmdhits__hitID
cmdhits.CommandType = 3
cmdhits.CommandTimeout = 0
cmdhits.Prepared = true
cmdhits.Execute()
%>
更多追问追答
追问
按你的改了之后
出现这个了
ADODB.Command 错误 '800a0bb9'
参数类型不正确,或不在可以接受的范围之内,或与其他参数冲突。
追答
那就改一下这个!
cmdhits.CommandType = 1
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
cmdhits.CommandText = "UPDATE fx SET hits = hits + 1 WHERE ID =’" + Replace(cmdhits__hitID, "'", "''") + "‘ "
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询