在VB中:
dim aa as integer
sql="select count(*) as  aa from 表名"为什么得不到aa的值?

解决方案 »

  1.   

    sql="select sum(字段) as aa from 表名"
    如果要统计条数
    Dim rst As New ADODB.Recordset
    sql="select 字段 from 表名"
    rst.Open sql, conn, adOpenKeyset, adLockPessimistic
    aa=rs1.RecordCount
      

  2.   

    Dim Rs As New ADODB.Recordset
    dim Cn as New ADODB.Connection
    sql="select count(*) from 表名"
    Rs.Open sql, Cn, adOpenKeyset, adLockPessimistic
    aa=rs(0)
      

  3.   

    Dim Rs As New ADODB.Recordset
    dim Cn as New ADODB.Connection
    Rs.Open "select count(*) as aa from 表名", Cn
    debug.print  rs!aa
    rs.close
      

  4.   

    Select count(*) as ll from Table
    或者用recordset.recordcount也可以。
      

  5.   

    Select count(*) as ll from Table
    或者用recordset.recordcount也可以。同意楼上的!!