public static DataSet selectStudent()
{
MySqlConnection conn = connection();
conn.Open();
MySqlCommand cmd = new MySqlCommand();
cmd.Connection = conn;
MySqlDataAdapter adap = new MySqlDataAdapter(@"SELECT person.*, student.gradePointAverage, student.majorField FROM person JOIN student", conn);
MySqlCommandBuilder sqlCmd = new MySqlCommandBuilder(adap);
DataSet sqlSet = new DataSet();
adap.Fill (sqlSet, "studentInfo");
conn.Close();
return sqlSet;
}
和按钮:
private void btnAdminStudentView_Click(object sender, EventArgs e)
{
DataSet ds = studentHelperClass.selectStudent();
dataGridStudent.DataSource = ds.Tables["studentInfo"];
}
为什么这会在按钮单击时给我这样的结果?