How do I determine the number of records in a SQL table and then save that value in variable?
See Question&Answers more detail:osHow do I determine the number of records in a SQL table and then save that value in variable?
See Question&Answers more detail:osUsing ADO to access the db:
SELECT count(0) FROM myTable
query.Not tested code:
Dim conn, rs, recordsCount
recordsCount = -1
'initialize the connection
set conn = ...
'run the query and retrieve the results
set rs = conn.execute("SELECT count(0) as cnt FROM myTable")
if not rs.EOF then
recordsCount = cint(rs("cnt"))
end if
'cleanup
rs.close
conn.close
set rs = nothing
set conn = nothing