ExecuteScalar函数功能有哪些?
OleDbCommand.ExecuteScalar Method
MSDN 资料
Executes the query, and returns the first column of the first row in the result set returned by the query. Additional columns or rows are ignored.
Namespace: System.Data.OleDb
Assembly: System.Data (in system.data.dll)
用处: 查询数据库总记录数
stringquerystr="selectcount(*)FromConanMsg";
OleDbCommandmycommand;
mycommand=newOleDbCommand(querystr,myconn);
intcount=(int)mycommand.ExecuteScalar();
OleDbCommandmycommand;
mycommand=newOleDbCommand(querystr,myconn);
intcount=(int)mycommand.ExecuteScalar();
count里保存的就是总记录数.
本文地址:http://www.45fan.com/dnjc/70191.html