Office中国论坛/Access中国论坛

标题: 数据更新问题 [打印本页]

作者: skillcn    时间: 2003-7-21 17:03
标题: 数据更新问题
第一次添加下载文档后,回首页点击该新添的下载文档就会出现无效使用 Null: 'CInt' ,但以后点击正常。
经查,添加新文档后,数据库download表下的"lasthit"记录为空,点击文档一次后,记录为当前日期。

原代码:
<%
'更新每周每日数据
lasthit=rs("lasthit")
tdate=year(Now()) & "-" & month(Now()) & "-" & day(Now())
if trim(lasthit)=trim(tdate) then
  sql="update download set dayhit=dayhit+1 where id="&request("id")
  conn.Execute(sql)
'  response.write "success"
else
  sql="update download set dayhit=1 where id="&request("id")
  conn.Execute(sql)
'  response.write "error"
end if
sql="update download set lasthit='"&tdate&"' where ID="&request("id")
conn.Execute(sql)

    p_year=CInt(year(Now()))-CInt(year(lasthit))
    p_month=CInt(month(Now()))-CInt(month(lasthit))
    p_day=CInt(day(Now()))-CInt(day(lasthit))
    period_time=((p_year*12+p_month)*30+p_day)
if cint(period_time)=<cint(7) then
  sql="update download set weekhit=weekhit+1 where id="&request("id")
  conn.Execute(sql)
else
  sql="update download set weekhit=1 where id="&request("id")
  conn.Execute(sql)
end if
%>

请指点如何修改以上代码,谢谢!





欢迎光临 Office中国论坛/Access中国论坛 (http://www.office-cn.net/) Powered by Discuz! X3.3