标题:代码分析
只看楼主
adweset
Rank: 1
等 级:新手上路
帖 子:22
专家分:0
注 册:2009-7-13
结帖率:57.14%
 问题点数:0 回复次数:2 
代码分析
我的这段代码有没有错
<%
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
gupiao175
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:40
帖 子:1787
专家分:7527
注 册:2007-6-27
得分:0 
你试着去执行不就知道有没有错了吗?怎么问人家有没有错误!

Q:1428196631,百度:开发地 即可找到我,有事请留言!
2010-03-31 19:14



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




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

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