c#中如何求表中得有多少条记录
来源:百度知道 编辑:UC知道 时间:2024/09/28 09:03:01
表中记录数
string RowCnt = ""; //记录数
sqlceconnection conn;
conn=new sqlceconnection(localconnection);
string strsql="select count(*) as cnt from #table";
sqlcecommand sqlcmd=new sqlcecommand(strsql,conn);
conn.open();
sqlcedatareader sdr=sqlcmd.executereader(); //执行sql语句//
if (sdr.read())
{
RowCnt =sdr["cnt "].tostring();//
}
sdr.Close();
conn.Close();
使用sql语句查询出记录数以后的数据负值出来就可以了吧
不知道你得到的是什么类型的,int a= table.count就可以了
select Count(*) from table
select count(*) from tablename