62,268
社区成员
发帖
与我相关
我的任务
分享#region 运用 sqlcommand.Excutescaler()来返回数据的行数
SqlConnection conn = new SqlConnection(" ");
SqlCommand cmd = new SqlCommand();
cmd.Connection = conn;
conn.Open();
cmd .CommandText = "select count(*) from表名";
int num = (int)cmd.ExecuteScalar();
Response.Write(string.Format("{0}", num));
#endregion