标题:代码分析
取消只看楼主
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



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-284216-1-1.html




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

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