.
參考答案:用一条sql语句就可以:
select count(*) as maxrow from table
这样一来读取的数据只有一行一列,列名是maxrow.列值就是你要的.
例如:
Conn.Open();
OleDbCommand Cmd = new OleDbCommand( "select count(*) as maxrow from table", Conn );
OleDbDataReader dbReader = Cmd.ExecuteReader();
dbReader.Read();//因为只有一行数据,所以不用循环读取.
Console.WriteLine( dbReader["maxrow"].ToString() );
dbReader.Close();
Conn.Close();