Exemplo n.º 1
0
        /// <summary>Processes an public query, relative to the data access object</summary>
        /// <param name="Dab">DataAccessBase object to execute the query against</param>
        /// <param name="Query">Query to run</param>
        /// <returns>ResultSet object containing data and messages as a result of the given query</returns>
        private ResultSet ProcessInternalQuery(DataAccessBase Dab, string Query, bool ReportProgress)
        {
            IDataReader reader = null;

            try
            {
                if (_cancelPending)
                {
                    throw new Exception("Operation cancelled");
                }
                reader = Dab.ExecuteReader(Query);
                ResultSet rs = new ResultSet();

                rs.Messages = reader.RecordsAffected + " rows affected";
                LoadResult(rs.Data, reader, Dab, ReportProgress);

                return rs;
            }
            catch
            {
                CheckCancel();
                throw;
            }
            finally
            {
                if (reader != null)
                    reader.Close();
            }
        }