private void Form1_Load(object sender, EventArgs e) { this.cbTeachers.DataSource = StaticSQLiteHelper.GetTeacherInformation(); this.cbTeachers.DisplayMember = "教师姓名"; this.cbTeachers.ValueMember = "教师编号"; //this.cbTeachers.SelectedIndex = 0; }
/// <summary> /// 载入全年级教师信息 /// </summary> public static void LoadGradTeachers() { DataTable dt = StaticSQLiteHelper.GetTeacherInformation(); _gradeTeacher = new TeacherCollection(dt.Rows.Count); int ti; string tn, sn, ssn; foreach (DataRow row in dt.Rows) { ti = Convert.ToInt32(row[0]); tn = row[1].ToString(); sn = row[2].ToString(); ssn = row[3].ToString(); _gradeTeacher.Add(ti, new Teacher(ti, tn, sn, ssn)); } }