Example #1
0
        private void ValidateConnection(string method)
        {
            if (null == _connection)
            {
                throw ADP.ConnectionRequired(method);
            }
            _connection.CheckStateOpen(method);

            // user attempting to execute the command while the first dataReader hasn't returned
            // use the connection reference collection to see if the dataReader referencing this
            // command has been garbage collected or not.
            if (_hasDataReader)
            {
                if (_connection.HasLiveReader(this))
                {
                    throw ADP.OpenReaderExists();
                }
                _hasDataReader = false;
            }
        }