示例#1
0
        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;
        }
示例#2
0
 public static void insertStudent(Student student)
 {
     System.Diagnostics.Trace.WriteLine(student, "Insert");
 }
示例#3
0
 public static void updateStudent(Student student)
 {
     System.Diagnostics.Trace.WriteLine(student, "Update");
 }
示例#4
0
 public static void deleteStudent(Student student)
 {
     System.Diagnostics.Trace.WriteLine(student, "Delete");
 }