这个问题已经很久了,在ACCESS中选中所有记录时,最下边的状态栏会显示出这张表的记录总数。而在SQL中如何用类似的方法查看到记录总数呢?(不会代码!!!)

解决方案 »

  1.   

    你打开某个记录集以后,取它的recordcount属性
      

  2.   


    rs.open "Select Sum(field) from table"
      

  3.   

    rs.Open "select sum(field) from table", cn, adOpenForwardOnly, adLockReadOnly
    MsgBox rs.Fields(0).Value或者rs.Open "select * from table", cn, adOpenStatic, adLockReadOnly
    MsgBox rs.RecordCount
    用此方法 , 游标类型一定要是: adOpenStatic , 否则返回 - 1
    第一种方法无限制!!
      

  4.   

    rs.CursorLocation =adUseClient 
    rs.open "你的表",cn
    debug.print rs.recordcount
    rs.close或
    rs.open "select count(*) as 记录总数 from yourtable ",cn
    debug.pring rs!记录总数
    rs.close
      

  5.   

    select count(*) as 记录总数 from yourtable
      

  6.   

    不是有个RecordCount属性的么?
      

  7.   

    select count(字段名) as 记录条数 from 表名
    如果该字段有null(没有数据)它不会统计
    select count(*) as 记录条数 from 表名
    统计所有的
      

  8.   

    这个问题已经很久了,在ACCESS中选中所有记录时,最下边的状态栏会显示出这张表的记录总数。而在SQL中如何用类似的方法查看到记录总数呢?(不会代码!!!)不好意思我把上面的“不用代码”打成了“不会代码”
    嘿嘿我的错
      

  9.   

    select count(field) from table