Ejemplo n.º 1
0
        void PopulateArray(clsDataConnection DB)
        {
            //populates the array list based on the data table in the parameter db
            //var for the index
            int index = 0;
            //var for the record count
            int recordCount;

            //get theocount of records
            recordCount = DB.Count;
            //clear the private array list
            mAllStudents = new List <clsStudent>();
            //while there are records to process
            while (index < recordCount)
            {
                //create a blank  template
                clsStudent AStudent = new clsStudent();
                //read the fields from the current records
                AStudent.StudentID    = Convert.ToInt32(DB.DataTable.Rows[index]["personID"]);
                AStudent.FirstName    = Convert.ToString(DB.DataTable.Rows[index]["firstName"]);
                AStudent.LastName     = Convert.ToString(DB.DataTable.Rows[index]["lastName"]);
                AStudent.AddressLine1 = Convert.ToString(DB.DataTable.Rows[index]["addressLine1"]);
                AStudent.AddressLine2 = Convert.ToString(DB.DataTable.Rows[index]["addressLine2"]);
                AStudent.City         = Convert.ToString(DB.DataTable.Rows[index]["city"]);
                AStudent.PostCode     = Convert.ToString(DB.DataTable.Rows[index]["postCode"]);
                AStudent.DateOfBirth  = Convert.ToDateTime(DB.DataTable.Rows[index]["dateOfBirth"]);
                AStudent.Email        = Convert.ToString(DB.DataTable.Rows[index]["email"]);
                AStudent.Telephone    = Convert.ToString(DB.DataTable.Rows[index]["telephone"]);

                //add the record to the private data member
                mAllStudents.Add(AStudent);
                //increase index
                index++;
            }
        }
Ejemplo n.º 2
0
 public clsStudentCollection()
 {
     //create an instance of the student class to store a student
     clsStudent aStudent = new clsStudent();
     //Set the
 }