Exemple #1
0
        protected override CDataBaseQueryResult RunAsCommand(DbCommand p_command)
        {
            DbDataReader p_reader = null;

            try
            {
                p_reader = p_command.ExecuteReader();

                CDataBaseQueryResult p_result = new CDataBaseQueryResult(this);
                p_result.RetrieveFromReader(p_reader);

                p_reader.Close();

                return(p_result);
            }
            catch (MySqlException p_except)
            {
                return(new CDataBaseQueryResult(this, p_except));
            }
            catch (Exception p_except)
            {
                throw p_except;
            }
            finally
            {
                if (p_reader != null)
                {
                    p_reader.Close();
                }
            }
        }
Exemple #2
0
        public CDataBaseResultSet ExecuteReader(String p_query)
        {
            using (DbConnection p_connection = GetConnection())
            {
                using (DbCommand p_command = p_connection.CreateCommand())
                {
                    p_command.CommandText = p_query;

                    RaiseCommandExecuted(this, p_command);

                    Queries.CDataBaseQueryResult p_result = new Queries.CDataBaseQueryResult(null);
                    p_result.RetrieveFromReader(p_command.ExecuteReader());
                    return(p_result.m_p_result_set);
                }
            }
        }