/// <summary>
        /// Closes the datareader, potentially closing the connection as well if CommandBehavior.CloseConnection was specified.
        /// </summary>
        public override void Close()
        {
            if (_command != null)
            {
                while (NextResult())
                {
                }
                _command.ClearDataReader();

                if (_disposeCommand)
                {
                    ((IDisposable)_command).Dispose();
                }
            }

            // If the datareader's behavior includes closing the connection, then do so here.
            if ((_commandBehavior & CommandBehavior.CloseConnection) != 0)
            {
                _command.Connection.Close();
            }

            _command         = null;
            _activeStatement = null;
            _fieldTypeArray  = null;
        }
        /// <summary>
        /// Closes the datareader, potentially closing the connection as well if CommandBehavior.CloseConnection was specified.
        /// </summary>
        public override void Close()
        {
            try
            {
                if (_command != null)
                {
                    try
                    {
                        try
                        {
                            // Make sure we've not been canceled
                            if (_version != 0)
                            {
                                try
                                {
                                    while (NextResult())
                                    {
                                    }
                                }
                                catch (SQLiteException)
                                {
                                }
                            }
                            _command.ClearDataReader();
                        }
                        finally
                        {
                            // If the datareader's behavior includes closing the connection, then do so here.
                            if ((_commandBehavior & CommandBehavior.CloseConnection) != 0 && _command.Connection != null)
                            {
                                _command.Connection.Close();
                            }
                        }
                    }
                    finally
                    {
                        if (_disposeCommand)
                        {
                            _command.Dispose();
                        }
                    }
                }

                _command         = null;
                _activeStatement = null;
                _fieldTypeArray  = null;
            }
            finally
            {
                if (_keyInfo != null)
                {
                    _keyInfo.Dispose();
                    _keyInfo = null;
                }
            }
        }