// Reader query - Basic - Get all rows from table Students
        public static void BasicReaderQuery_1()
        {
            string query = "SELECT * FROM Students";

            List <SqlParameter> parameters = new List <SqlParameter>();
            ArrayList           results    = ConnectedDBAccess.ExecuteQuery <Student>(query, parameters);

            printResults(results);
        }
        public ArrayList GetAllStudents()
        {
            string query = "SELECT * FROM Students";

            List <SqlParameter> parameters = new List <SqlParameter>();
            ArrayList           results    = ConnectedDBAccess.ExecuteQuery <Student>(query, parameters);

            return(results);
        }
        // Reader query - with parameter - Get all rows from table Students where age < 40
        public static void ReaderQueryWithParam_2()
        {
            string query = "SELECT * FROM Students WHERE age < @AGE";

            List <SqlParameter> parameters = new List <SqlParameter>();

            parameters.Add(new SqlParameter("AGE", 40));

            ArrayList results = ConnectedDBAccess.ExecuteQuery <Student>(query, parameters);

            printResults(results);
        }
        public Student GetStudent(int id)
        {
            string query = "SELECT * FROM Students WHERE id = @ID";

            List <SqlParameter> parameters = new List <SqlParameter>();

            parameters.Add(new SqlParameter("ID", id));

            ArrayList results = ConnectedDBAccess.ExecuteQuery <Student>(query, parameters);

            return((Student)results[0]);
        }
        public ArrayList GetStudentsByCountry(string country)
        {
            string query = "SELECT * FROM Students WHERE country = @COUNTRY";

            List <SqlParameter> parameters = new List <SqlParameter>();

            parameters.Add(new SqlParameter("COUNTRY", country));

            ArrayList results = ConnectedDBAccess.ExecuteQuery <Student>(query, parameters);

            return(results);
        }
        // Reader query - Stored procedure - Get all rows from table Students
        public static void BasicReaderQueryStoredPorcedure_6()
        {
            /*
             * Defined in DB as:
             * CREATE PROCEDURE getAllStudents AS
             * SELECT * FROM dbo.Students
             */
            string query = "getAllStudents";

            List <SqlParameter> parameters = new List <SqlParameter>();
            ArrayList           results    = ConnectedDBAccess.ExecuteQuery <Student>(query, parameters, CommandType.StoredProcedure);

            printResults(results);
        }