コード例 #1
0
        void PopulateArray(clsDataConnection dBConnection)
        {
            //populates the array list based on the data table in the parameter DB
            //var for the index
            Int32 Index = 0;
            //var to store the record count
            Int32 RecordCount = 0;

            //get the count of recordsA
            RecordCount = dBConnection.Count;
            //clear the private array list
            mReviewList = new List <clsReview>();
            //while there are records to process
            while (Index < RecordCount)
            {
                //create a blank address
                clsReview AReview = new clsReview();
                //read in the fields from the current record
                AReview.ReviewId     = Convert.ToInt32(dBConnection.DataTable.Rows[Index]["ReviewId"]);
                AReview.Description  = Convert.ToString(dBConnection.DataTable.Rows[Index]["Description"]);
                AReview.DateReviewed = Convert.ToDateTime(dBConnection.DataTable.Rows[Index]["DateReviewed"]);
                AReview.Rating       = Convert.ToInt32(dBConnection.DataTable.Rows[Index]["Rating"]);
                AReview.Email        = Convert.ToString(dBConnection.DataTable.Rows[Index]["Email"]);
                AReview.ProductId    = Convert.ToInt32(dBConnection.DataTable.Rows[Index]["ProductId"]);

                //add the record to the private data member
                mReviewList.Add(AReview);
                //point at the next record
                Index++;
            }
        }
コード例 #2
0
        public void PopulateArray(clsDataConnection DB)
        {
            Int32 Index = 0;
            Int32 RecordCount;

            //get the count of the records
            RecordCount = DB.Count;
            //clear th eprivate record list
            mReviewList = new List <clsReview>();
            while (Index < RecordCount)
            {
                clsReview Review = new clsReview();
                Review.ReviewID    = Convert.ToInt32(DB.DataTable.Rows[Index]["ReviewID"]);
                Review.Username    = Convert.ToString(DB.DataTable.Rows[Index]["Username"]);
                Review.Description = Convert.ToString(DB.DataTable.Rows[Index]["Description"]);
                Review.Rating      = Convert.ToInt32(DB.DataTable.Rows[Index]["Rating"]);
                Review.RevDate     = Convert.ToString(DB.DataTable.Rows[Index]["RevDate"]);
                Review.SystemName  = Convert.ToString(DB.DataTable.Rows[Index]["SystemName"]);
                mReviewList.Add(Review);
                Index++;
            }
        }