微表情读心术 测试:update语句问题

来源:百度文库 编辑:杭州交通信息网 时间:2024/04/28 06:32:16
本人用ASP+Access做一个计数器,代码如下:
=================================================================
<%
dim db,str,rs,total,today,the_date
set db=server.createobject("ADODB.connection")
db.open "Dsn=class_data"
str="select * from counter where ID=1"
set rs=db.execute(str)
the_date=date()
if rs("date")<>the_date then
str="update counter set today_count=0,date=#"&the_date&"# where ID=1"
db.execute(str)
end if
today=rs("today_count")+1
total=rs("total_count")+1
str="update counter set total_count="&total&",today_count="&today&" where ID=1"
db.execute(str)
response.write "<table border='0' width='250'><tr align='center'><td><font color='#ADADAD'>访问总量:</font></td><td width='50'>"&total&"</td><td><font color='#ADADAD'>今日访问:</font></td><td width='50'>"&today&"</td></tr></table>"
%>
=================================================================
但老是提示:update语法错误.真不知道错在哪,请指教.
我建的数据表如下:
ID:自动编号
total_day:长整型
today_day:长整型
date:日期型
提示错误的语句是:str="update counter set today_count=0,date=#"&the_date&"# where ID=1"

引号里面要用单引号或者三引号吧~!