private void SetIndex(int index, bool allowCurrent) { if (index < 0 || index >= NumFields) { throw new IndexOutOfRangeException(); } if ((!allowCurrent || _reader.CurrentlyStreaming) ? index <= _lastIndex : index < _lastIndex) { throw new InvalidOperationException( string.Format("Invalid attempt to read from column ordinal '{0}'. With CommandBehavior.SequentialAccess, you may only read from column ordinal '{1}' or greater.", index, _lastIndex + 1)); } _reader.Skip(index - _lastIndex - 1); _lastIndex = index; }
private void SetIndex(int index, bool allowCurrent) { if (index < 0 || index >= NumFields) { throw new IndexOutOfRangeException(); } if ((!allowCurrent || _reader.CurrentlyStreaming) ? index <= _lastIndex : index < _lastIndex) { throw new InvalidOperationException( string.Format(resman.GetString("Row_Sequential_Field_Error"), index, _lastIndex + 1)); } _reader.Skip(index - _lastIndex - 1); _lastIndex = index; }