这个update语句为何报错?
<%
dim rs,re_id
dim sqlstr
re_id=request.form( "id ")
set rs=server.CreateObject( "ADODB.RecordSet ")
sqlstr= "update voteinfo set count=count+1 where id= "&re_id
rs.open sqlstr,conndb,1,3
rs.close
set rs=nothing
%>
为什么老是报告update附近语法错误呢?
使用respnse.write ,我确认re_id的值已经传递了..
------解决方案-------------------- <%
dim re_id
dim sqlstr
re_id=request.form( "id ")
sqlstr= "update voteinfo set count=count+1 where id= " & re_id
response.write sqlstr
conndb.execute sqlstr
conndb.close
set conndb=nothing
%>
response.write sqlstr 显示的语句在数据库里执行看看
------解决方案--------------------sqlstr= "update [voteinfo] set [count]=([count]+1) where id= "&re_id
或者改成
sqlstr= "select * form voteinfo where id= "&re_id
rs.open sqlstr,conndb,1,3
rs( "count ")=rs( "count ")+1
rs.update
rs.close
set rs=nothing