|
|||||
|
<% Dim n, c, conn, rs, sql, database, table, field ' Call results of Field "Situation" in table "Friends" in database "People.mdb" Call TrackField("db/Ticker.mdb", "calllog", "CLProblemCat") Sub TrackField(database,table,field) sql = "select " & field & " from " & table & " order by " & field OpenRS(database) c = 0 t = 0 ReDim A(1) ReDim V(1) while not rs.eof if rs(field) <> A(c) then c = c + 1 ReDim Preserve A(c), V(c) A(c) = rs(field) V(c) = 1 else V(c) = V(c) + 1 end if t = t + 1 rs.moveNext wend CloseRS() if t > 0 then response.write "
Total: " & t & " " else response.write " No records. "
end if
End Sub
Function OpenDB(database)
Set conn = server.createobject("adodb.connection")
conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(database) & ";"
End Function
Function CloseDB()
conn.Close
Set conn = nothing
End Function
Function OpenRS(database)
OpenDB(database)
set rs = conn.execute(sql)
End Function
Function CloseRS()
set rs = nothing
CloseDB()
End Function
%>
|