ASP用SELECT COUNT统计记录总数提示运行时错误

来源:百度知道 编辑:UC知道 时间:2024/06/23 02:17:24
一个表table,里面有四个字段分别是id,sex,name和age,我希望取出前三个字段以及总的记录个数
dim rs,sql
Set rs = Server.CreateObject("ADODB.Recordset")
sql="select count(*) as zoshu from table"
sql="select id,sex,name from table"
rs.open sql,conn,1,1

提示运行时错误 要怎么解决呢 望高手支招..

两句SQL语句,句柄打开一次,只执行一句SQL语句。。

Set rs = Server.CreateObject("ADODB.Recordset")
sql="select id,sex,name from table"
rs.open sql,conn,1,1

表table的记录总数,可以用rs.recordcount来获得。