%
class c_Counter
private rs
private cgroup, cname
private sub class_initialize
Set rs = Server.CreateObject("ADODB.RecordSet")
end sub
private sub class_terminate
rs.close:set rs=nothing
end sub
public property let CounterGroup(v)
cgroup = v
end property
public property let CounterName(v)
cname = v
end property
public property get Total
Total = conn.execute("select sum(counter) from counters where countergroup='"&replace(cgroup,"'","''")&"' and countername="&cname)(0)
end property
public property get Year
Year = conn.execute("select sum(counter) from counters where countergroup='"&replace(cgroup,"'","''")&"' and countername="&cname&" and dateadd('yyyy',1,counterdate)>date()")(0)
end property
public property get Quarter
Quarter = conn.execute("select sum(counter) from counters where countergroup='"&replace(cgroup,"'","''")&"' and countername="&cname&" and dateadd('q',1,counterdate)>date()")(0)
end property
public property get Month
Month = conn.execute("select sum(counter) from counters where countergroup='"&replace(cgroup,"'","''")&"' and countername="&cname&" and dateadd('m',1,counterdate)>date()")(0)
end property
public property get Week
Week = conn.execute("select sum(counter) from counters where countergroup='"&replace(cgroup,"'","''")&"' and countername="&cname&" and dateadd('ww',1,counterdate)>date()")(0)
end property
public property get Day
Day = conn.execute("select sum(counter) from counters where countergroup='"&replace(cgroup,"'","''")&"' and countername="&cname&" and dateadd('d',1,counterdate)>date()")(0)
end property
public sub count
rs.open "select * from counters where countergroup='"&replace(cgroup,"'","''")&"' and countername="&cname&" and counterdate=date()", conn,1,3
if rs.eof then
rs.addnew
rs("countergroup") = cgroup
rs("countername") = cname
rs("counter") = 1
rs("counterdate") = date
else
rs("counter") = rs("counter") + 1
end if
rs.update
end sub
end class
dim conn
Set conn = Server.CreateObject("ADODB.Connection")
conn.open "Provider=Microsoft.Jet.OLEDB.4.0;Jet OLEDB:Database Password=;Data Source=" & Server.MapPath("/hezepc/pubcms.asa")
on error resume next
dim counter
set counter = new c_Counter
with counter
.countergroup = "category"
.countername = 36
.count
end with
set counter = nothing
%>
菏泽易达科技 - 首页