public List<Student> StudentList(int StaffID) { List<Student> Roster = new List<Student>(); //Connect to SQL Server SqlConnection conn = new SqlConnection("Data Source=(local); Database=WebDevelopmentDB; Integrated Security=SSPI"); conn.Open(); //Select all distinct Student ID's that occur in a specified Tutors classes SqlCommand cmd = new SqlCommand("SELECT Distinct StudentID FROM [WebDevelopmentDB].[dbo].[ClassRoster] where ClassID in (Select ClassID from[WebDevelopmentDB].[dbo].ClassList where TutorID = " + StaffID + ")", conn); SqlDataReader rdr = cmd.ExecuteReader(); string StudentID; while (rdr.NextResult()) { StudentID = rdr[0].ToString(); Student tmp = new Student(Convert.ToInt32(StudentID)); Roster.Add(tmp); } //Close the reader and the SQL connection if (rdr != null) { rdr.Close(); } conn.Close(); return Roster; }
public static void insertStudent(Student student) { System.Diagnostics.Trace.WriteLine(student, "Insert"); }
public static void updateStudent(Student student) { System.Diagnostics.Trace.WriteLine(student, "Update"); }
public static void deleteStudent(Student student) { System.Diagnostics.Trace.WriteLine(student, "Delete"); }