当前位置: 代码迷 >> ASP.NET >> SQL返回值。解决方法
  详细解决方案

SQL返回值。解决方法

热度:5947   发布时间:2013-02-25 00:00:00.0
SQL返回值。。。
string   strSql   =   "select   count(*)   from   rsm_frame   where   roomid= 'a1 ' ";
我想获得执行这条SQL语句的返回值,请问应该用什么函数?

------解决方案--------------------------------------------------------
ExecuteScalar
------解决方案--------------------------------------------------------
SqlCommand com=new SqlCommand( "select count(*) from rsm_frame where roomid= 'a1 ' ",con);
con.open()
int count=(int)com.ExecuteScalar();
con.close();
  相关解决方案