public void getFacultySchedule(string getp) { db = new DatabaseLayer.DBConnection(); string query = "SELECT CourseName FROM OfferedCourses_Spring_17 WHERE CourseTeacher='" + getp + "';"; db.GetQuery(query); if (db.dr.HasRows) { while (db.dr.Read()) { if (db.dr[0].ToString() != null) { try { string sl = db.dr.GetString(0); courseList.Add(new Courses(sl)); } catch (Exception ex) { continue; } } } db.dr.Dispose(); } //} db.con.Dispose(); this.GetCourseList("Spring_17"); }
public void GetCourseList(string s) { db = new DatabaseLayer.DBConnection(); for (int i = 0; i < courseList.Count; i++) { string query = "SELECT * FROM OfferedCourses_" + s + " WHERE CourseName='" + courseList[i].courseName + "';"; db.GetQuery(query); if (db.dr.HasRows) { while (db.dr.Read()) { courseList[i].SetValue(db.dr.GetString(0), db.dr.GetString(2), db.dr.GetString(3), db.dr.GetString(5), db.dr.GetString(5), db.dr.GetString(6)); } db.dr.Dispose(); } } db.con.Dispose(); }