Beispiel #1
0
        public static clsListStudent getAllStudent()
        {
            clsListStudent  allClients = new clsListStudent();
            OleDbConnection mycon      = new OleDbConnection();

            mycon.ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Users\Ravi patel\source\repos\PrjWinCsExam\PrjWinCsExam\Database\College.accdb";
            mycon.Open();

            OleDbCommand mycmd = new OleDbCommand();

            mycmd.CommandText = "SELECT SNumber, SName, SBirthdate, SAverage FROM Students";
            mycmd.Connection  = mycon;

            OleDbDataReader myRder = mycmd.ExecuteReader();

            while (myRder.Read())
            {
                string     num      = myRder["SNumber"].ToString();
                string     name     = myRder["SName"].ToString();
                string     date     = myRder["SBirthdate"].ToString();
                string     avg      = myRder["SAverage"].ToString();
                clsStudent aStudent = new clsStudent(num, name, date, Single.Parse(avg));
                allClients.Add(aStudent);
            }

            return(allClients);
        }
 public clsCourse(string number, string title, clsListStudent students)
 {
     cNumber   = number;
     cTitle    = title;
     cStudents = students;
 }
 public clsCourse()
 {
     cNumber   = "Not Defined";
     cTitle    = "Not Defined";
     cStudents = new clsListStudent();
 }