怎么用MessageBox或者TextBox输出select的查询结果
SqlConnection conn = new SqlConnection(@"Data Source=PC2011102013SPQ\SQLEXPRESS;Initial Catalog=T_Students;Integrated Security=True");
conn.Open();
SqlCommand cmd = conn.CreateCommand();
cmd.CommandText = "select avg(Score)as平均成绩 from T_Students";
执行了这些代码,怎么可以把cmd.CommandText = "select avg(Score)as平均成绩 from T_Students";得执行结果用MessageBox或者TextBox输出:
|