cmd.CommandText = "select * from T_Score where Score>@CScore";
cmd.Parameters.Add(new SqlParameter("CScore",CScore));
using (SqlDataReader reader = cmd.ExecuteReader())
{
while(reader.Read())
{
txtResult.Text+= " " + reader.GetString(reader.GetOrdinal("name")); //name是数据库中学生姓名的字段名
}
} |