void BindCourseName() { string strErr = ""; DataTable objDataTable = new DataTable(); Manage.Course.Course objCourse = new Manage.Course.Course(strConnection); int iRent = objCourse.SearchCourse1(out objDataTable, out strErr); if (iRent == 0) { MessageBox.Show(strErr); return; } else { cmbCourseName.DataSource = objDataTable; cmbCourseName.DisplayMember = "课程名称"; cmbCourseName.ValueMember = "课程ID"; } }
void BindCourseId() //绑定课程信息 { string strConnection = System.Configuration.ConfigurationManager.ConnectionStrings["StudentManager"].ConnectionString; Manage.Course.Course objCourse = new Manage.Course.Course(strConnection); string strErr = ""; DataTable objDataTable = new DataTable(); int iRent = objCourse.SearchCourse1(out objDataTable, out strErr); if (iRent == 0) { MessageBox.Show(strErr); return; } else { cmbCourseName.DataSource = objDataTable; cmbCourseName.DisplayMember = "课程名称"; cmbCourseName.ValueMember = "课程ID"; } }