public int RetrieveGamesFromBD()
 {
     int gameID;
     float price;
     int unitsSold;
     int counter = 0;
     SqlDataReader MyReader = DatabaseAccess.getDataFromDB("SELECT * FROM [GameOfStore]");
     if (MyReader.HasRows == false)
         return 0;
     while (MyReader.Read())
     {
         gameID = Convert.ToInt32(MyReader["gameID"].ToString());
         price = (float)Convert.ToDouble(MyReader["price"].ToString());
         unitsSold = Convert.ToInt32(MyReader["unitSold"].ToString());
         storeGames[counter] = new GameOfStore(gameID, price, unitsSold);
         counter++;
     }
     MyReader.Close();
     return counter;
 }
Exemple #2
0
        public int RetrieveGamesFromBD()
        {
            int           gameID;
            float         price;
            int           unitsSold;
            int           counter  = 0;
            SqlDataReader MyReader = DatabaseAccess.getDataFromDB("SELECT * FROM [GameOfStore]");

            if (MyReader.HasRows == false)
            {
                return(0);
            }
            while (MyReader.Read())
            {
                gameID              = Convert.ToInt32(MyReader["gameID"].ToString());
                price               = (float)Convert.ToDouble(MyReader["price"].ToString());
                unitsSold           = Convert.ToInt32(MyReader["unitSold"].ToString());
                storeGames[counter] = new GameOfStore(gameID, price, unitsSold);
                counter++;
            }
            MyReader.Close();
            return(counter);
        }