<%
set rs=server.create("adodb.recordset")
rs.open "select count(*) as total from contents",conn,1,1
if not rs.eof then
num=rs(0)
else
num=0
end if
rs.close
set rs=nothing
response.write("contents表的记录总数是:"&num)
%>
前提是有conn了
set rs = server.createobject("adodb.recordset")
sql = "select count(*) as total from contents "
rs.open sql,conn,1,1
if not rs.eof then
totalnum = rs("total")
end if
要用总数就用这个totalnum好了