| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 867 人关注过本帖
标题:代码分析
取消只看楼主 加入收藏
adweset
Rank: 1
等 级:新手上路
帖 子:22
专家分:0
注 册:2009-7-13
结帖率:57.14%
收藏
 问题点数:0 回复次数:1 
代码分析
我的这段代码有没有错
<%
Dim id,Rs,SQL
Dim Hits,r_hits,z_hits,y_hits,HitsTime,stype
If Not IsNumeric(Request("id")) And Request("id") <> "" then
 Response.Write"错误的系统参数!ID必须是数字"
 Response.End
Else
 id = CLng(Request.querystring("id"))
End If
stype = CLng(Request.querystring("type"))
If Not IsObject(Conn) Then ConnectionDatabase
        Set Rs = Server.CreateObject("ADODB.Recordset")
        sql="select Hits,r_hits,z_hits,y_hits,HitsTime from Article where id="& id
        set rs=server.createobject("adodb.recordset")
        rs.open sql,conn,1,3
If Not Rs.EOF Then
 hits = CLng(Rs("hits"))+1
 Rs("hits").Value = hits
        If DateDiff("Ww", Rs("HitsTime"), Now()) <= 0 Then
            Rs("r_hits").Value = Rs("r_hits").Value + 1
    Else
            Rs("r_hits").Value = 1
    End If
        If DateDiff("M", Rs("HitsTime"), Now()) <= 0 Then
            Rs("z_hits").Value = Rs("z_hits").Value + 1
    Else
            Rs("z_hits").Value = 1
    End If
        If DateDiff("D", Rs("HitsTime"), Now()) <= 0 Then
            Rs("y_hits").Value = Rs("y_hits").Value + 1
    Else
            Rs("y_hits").Value = 1
            Rs("HitsTime").Value = Now()
    End If
    Rs.Update
                Hits = Rs("Hits")
                r_hits = Rs("r_hits")
                z_hits = Rs("z_hits")
                y_hits = Rs("y_hits")
        End If
        Rs.close
        set Rs=nothing
CloseConn
If stype = 1 Then
 Response.Write "var oHits=document.getElementById(""ArticleHits"");" & vbNewLine
 Response.Write "if (oHits!=null) {" & vbNewLine
 Response.Write "oHits.innerHTML="& Chr(34) &"本日:"& r_hits &" 本周:"& z_hits &" 本月:"& y_hits &" 总数:"& Hits &" "& Chr(34) &"" & vbNewLine
 Response.Write "}" & vbNewLine
Else
 Response.Write "document.write ("& Chr(34) &"本日:"& r_hits &" 本周:"& z_hits &" 本月:"& y_hits &" 总数:"& Hits &" "& Chr(34) &");"
End If
%>
搜索更多相关主题的帖子: 代码 
2009-08-31 03:04
adweset
Rank: 1
等 级:新手上路
帖 子:22
专家分:0
注 册:2009-7-13
收藏
得分:0 
回复 楼主 adweset
怎么没人知道吗
2009-08-31 16:18
快速回复:代码分析
数据加载中...
 
   



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

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