sql count 结果怎么在C#中返回
using System.Data.SqlClient;
SqlConnection conn =new SqlConnection(
"server=localhost; Initial Catalog=数据库的名字;Integrated Security=SSPI");
SqlCommand countCmd = conn.CreateCommand();
countCmd.CommandText="select count(no) as noCount from 表";
conn.Open();
int num = (int)countCmd.ExecuteScalar();
countCmd.Dispose();
conn.Close();