private void FillCourseComboBox() { connection.Open(); string queryString = "SELECT * FROM Course_Info_Table WHERE Dept_ID='" + gateways.Call_DeptID(dept) + "' AND Year='" + year + "' AND Semester='" + semester + "'"; SqlCommand command = new SqlCommand(queryString, connection); SqlDataReader reader = command.ExecuteReader(); while (reader.Read()) { courseName = reader["Course_Name"].ToString();// +" - ( " + reader["Course_No"].ToString() + " ) "; courseComboBox.Items.Add(courseName); } connection.Close(); }