需要将数据库中筛选某列中含有某个字段的数据的数量统计出来并且显示在vs winform的lable控件上,求解决
string constr = "连接字符串";
string sql = "select 字段 from 表 where 条件";
SqlConnection conn = new SqlConnection(constr);
conn.Open();
SqlCommand cmd = new SqlCommand(sql, conn);
label1.Text = cmd.ExecuteScalar().ToString();