public Ad_AddStudent(Ad_StuManage parent) { InitializeComponent(); pform = parent; string sql1 = "select distinct sgrade from students"; if (Ad_StuManage.ExecuteSql(sql1) != 0) { this.cbox_grade.DataSource = Ad_StuManage.Query(sql1).Tables["students"]; cbox_grade.DisplayMember = "sgrade"; } }
public Ad_UpdateStudent(Ad_StuManage parent, string sid, string sname, string ssex, string sgrade, string sdept, string syear, string sage) { InitializeComponent(); pform = parent; tbox_sid.Text = sid; tbox_sname.Text = sname; cbox_sex.Text = ssex; cbox_grade.Text = sgrade; tbox_major.Text = sdept; cbox_year.Text = syear; tbox_sage.Text = sage; oldsid = sid; string sql1 = "select distinct sgrade from students"; if (Ad_StuManage.ExecuteSql(sql1) != 0) { this.cbox_grade.DataSource = Ad_StuManage.Query(sql1).Tables["students"]; cbox_grade.DisplayMember = "sgrade"; } }