如何用SqlCommand统计Sql Server表中的记录条数

解决方案 »

  1.   

    select count(*) from 表名
    我想不到其它方法.
      

  2.   

    dim cmd as new sqlcommand("select count(*) from table",conn)
    conn.open
    dim intrs as integer = cmd.executescalar()然后通过这个intrs就能知道有多少条记录了
      

  3.   

    SqlCommand cmd=new SqlCommand(select count(*) from table ,conn);
    conn.Open();
    this.label1.Text=Convert.ToString(cmd.ExecuteScalar());