| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 764 人关注过本帖
标题:求中段代码的详细说明
只看楼主 加入收藏
adweset
Rank: 1
等 级:新手上路
帖 子:22
专家分:0
注 册:2009-7-13
结帖率:57.14%
收藏
 问题点数:0 回复次数:1 
求中段代码的详细说明
sql="select * from SoftDown_SoftInfo where SoftID="&SoftID
 rs.open sql,conn,1,1
 DayDate=trim(rs("DayDate"))
 WeekDate=trim(rs("WeekDate"))
 MonthDate=trim(rs("MonthDate"))
 AllHits=trim(rs("AllHits"))
 avgGrade=trim(rs("avgGrade"))
 Points=rs("Points")
 '更新软件下载次数
 sql="update SoftDown_SoftLink set Hits=Hits+1 where Id=" & cstr(request.QueryString("ID"))
 conn.execute sql
 sql="update SoftDown_SoftInfo set AllHits=AllHits+1,DayHits=DayHits+1,WeekHits=WeekHits+1,MonthHits=Monthhits+1 where SoftId=" & SoftID
 conn.execute sql

 if datediff("H",DayDate,Now)>=24 then
 sql="update SoftDown_SoftInfo set DayDate=Now(),DayHits=1 where SoftId=" & SoftID
 conn.execute sql      
 end if

 if datediff("D",WeekDate,Now)>=7 then
 sql="update SoftDown_SoftInfo set WeekDate=Now(),WeekHits=1 where SoftId=" & SoftID
 conn.execute sql
 end if

 if datediff("D",MonthDate,Now)>=31 then
 sql="update SoftDown_SoftInfo set MonthDate=Now(),MonthHits=1 where SoftId=" & SoftID
    conn.execute sql
 end if

 rs.close
搜索更多相关主题的帖子: 代码 详细说明 
2009-08-31 01:50
gupiao175
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:40
帖 子:1787
专家分:7527
注 册:2007-6-27
收藏
得分:0 
sql="select * from SoftDown_SoftInfo where SoftID="&SoftID //在数据库表SoftDown_SoftInfo中查询字段SoftID=变量SoftID的所有相关数据。
rs.open sql,conn,1,1 //以只读方式打开该数据表
DayDate=trim(rs("DayDate")) //取得数据库SoftDown_SoftInfo表里DayDate字段的值并将其两边空格去除后存入变量DayDate里,trim是ASP自带函数,下同!
WeekDate=trim(rs("WeekDate")) //取得数据库SoftDown_SoftInfo表里WeekDate字段的值并将其两边空格去除后存入变量WeekDate里,下同!
MonthDate=trim(rs("MonthDate")) 同上
AllHits=trim(rs("AllHits")) 同上
avgGrade=trim(rs("avgGrade")) 同上
Points=rs("Points") 同上,区别就是没用trim函数
'更新软件下载次数
sql="update SoftDown_SoftLink set Hits=Hits+1 where Id=" & cstr(request.QueryString("ID")) //根据SoftDown_SoftLink表里的ID值更新Hits字段(使其加1)
conn.execute sql //执行数据库操作代码(也就是上面的代码)
sql="update SoftDown_SoftInfo set AllHits=AllHits+1,DayHits=DayHits+1,WeekHits=WeekHits+1,MonthHits=Monthhits+1 where SoftId=" & SoftID
conn.execute sql //根据SoftDown_SoftLink表里的SoftID值更新AllHits、DayHits、WeekHits、MonthHits等4个字段(都使其加1)

if datediff("H",DayDate,Now)>=24 then //将DayDate和Now两个变量的时间进行比较,取得小时值,如果大于等于24则执行下面的代码,否则直接跳出该IF语句,执行下一个IF。关于DATEDIFF函数可以自己上百度上找,也是自带函数!
sql="update SoftDown_SoftInfo set DayDate=Now(),DayHits=1 where SoftId=" & SoftID
conn.execute sql      
end if

if datediff("D",WeekDate,Now)>=7 then//将WeekDate和Now两个变量的时间进行比较,取得星期值,如果大于等于7则执行下面的代码,否则直接跳出该IF语句,执行下一个IF。
sql="update SoftDown_SoftInfo set WeekDate=Now(),WeekHits=1 where SoftId=" & SoftID
conn.execute sql
end if

if datediff("D",MonthDate,Now)>=31 then //将MonthDate和Now两个变量的时间进行比较,取得日期值,如果大于等于31则执行下面的代码,否则直接跳出该IF语句,执行下一个IF。
sql="update SoftDown_SoftInfo set MonthDate=Now(),MonthHits=1 where SoftId=" & SoftID
    conn.execute sql
end if

rs.close //关闭数据库!

Q:1428196631,百度:开发地 即可找到我,有事请留言!
2010-03-31 17:33
快速回复:求中段代码的详细说明
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.021153 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved