Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/
Class

AccessDataReader

OfficeIMO.Access

Namespace
OfficeIMO.Access
Assembly
OfficeIMO.Access
Source revision
0eef6a5756b9 with working tree changes
Base
DbDataReader
Implements
IDataReader IDisposable IDataRecord IEnumerable IAsyncDisposable
Modifiers
sealed
Attributes
DefaultMember("Item")

Forward-only typed reader for modeled or qualified native rows. Disposal releases its document lease.

Inheritance

  • DbDataReader
  • AccessDataReader

Usage

Explore 2 API references to this type

This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.

Methods

public override void Close() #

Closes the DbDataReader object.

public override bool GetBoolean(int ordinal) #

When overridden in a derived class, gets the value of the specified column as a Boolean.

Parameters

ordinal int required
The zero-based column ordinal.

Returns

bool The value of the specified column.

Exceptions

  • IndexOutOfRangeException – The column index is out of range.
  • InvalidCastException – The specified cast is not valid.
public override byte GetByte(int ordinal) #

When overridden in a derived class, gets the value of the specified column as a byte.

Parameters

ordinal int required
The zero-based column ordinal.

Returns

byte The value of the specified column.

Exceptions

  • IndexOutOfRangeException – The column index is out of range.
  • InvalidCastException – The specified cast is not valid.
public override long GetBytes(int ordinal, long dataOffset, byte[]? buffer, int bufferOffset, int length) #

When overridden in a derived class, reads a specified number of bytes from the specified column starting at a specified index and writes them to a buffer starting at a specified position in the buffer.

Parameters

ordinal int required
The zero-based column ordinal.
dataOffset long required
The index within the row from which to begin the read operation.
buffer byte[]? required
The buffer into which to copy the data.
bufferOffset int required
The index with the buffer to which the data will be copied.
length int required
The maximum number of bytes to read.

Returns

long The actual number of bytes read.

Exceptions

  • IndexOutOfRangeException – The column index is out of range.
  • InvalidCastException – The specified cast is not valid.
public override char GetChar(int ordinal) #

When overridden in a derived class, gets the value of the specified column as a single character.

Parameters

ordinal int required
The zero-based column ordinal.

Returns

char The value of the specified column.

Exceptions

  • IndexOutOfRangeException – The column index is out of range.
  • InvalidCastException – The specified cast is not valid.
public override long GetChars(int ordinal, long dataOffset, char[]? buffer, int bufferOffset, int length) #

When overridden in a derived class, reads a specified number of characters from a specified column starting at a specified index, and writes them to a buffer starting at a specified position.

Parameters

ordinal int required
The zero-based column ordinal.
dataOffset long required
The index within the row from which to begin the read operation.
buffer char[]? required
The buffer into which to copy the data.
bufferOffset int required
The index with the buffer to which the data will be copied.
length int required
The maximum number of characters to read.

Returns

long The actual number of characters read.
public override string GetDataTypeName(int ordinal) #

When overridden in a derived class, gets name of the data type of the specified column.

Parameters

ordinal int required
The zero-based column ordinal.

Returns

string The name of the data type.

Exceptions

  • IndexOutOfRangeException – The column index is out of range.
public override DateTime GetDateTime(int ordinal) #

When overridden in a derived class, gets the value of the specified column as a DateTime object.

Parameters

ordinal int required
The zero-based column ordinal.

Returns

DateTime The value of the specified column.

Exceptions

  • IndexOutOfRangeException – The column index is out of range.
  • InvalidCastException – The specified cast is not valid.
public override decimal GetDecimal(int ordinal) #

When overridden in a derived class, gets the value of the specified column as a decimal.

Parameters

ordinal int required
The zero-based column ordinal.

Returns

decimal The value of the specified column.

Exceptions

  • IndexOutOfRangeException – The column index is out of range.
  • InvalidCastException – The specified cast is not valid.
public override double GetDouble(int ordinal) #

When overridden in a derived class, gets the value of the specified column as a double-precision floating point number.

Parameters

ordinal int required
The zero-based column ordinal.

Returns

double The value of the specified column.

Exceptions

  • InvalidCastException – The specified cast is not valid.
public override IEnumerator GetEnumerator() #

When overridden in a derived class, returns an enumerator that can be used to iterate through the rows in the data reader.

Returns

IEnumerator An enumerator that can be used to iterate through the rows in the data reader.
public override Type GetFieldType(int ordinal) #

When overridden in a derived class, gets the data type of the specified column.

Parameters

ordinal int required
The zero-based column ordinal.

Returns

Type The data type of the specified column.

Exceptions

  • IndexOutOfRangeException – The column index is out of range.
  • InvalidCastException – The specified cast is not valid.
public override float GetFloat(int ordinal) #

When overridden in a derived class, gets the value of the specified column as a single-precision floating point number.

Parameters

ordinal int required
The zero-based column ordinal.

Returns

float The value of the specified column.

Exceptions

  • IndexOutOfRangeException – The column index is out of range.
  • InvalidCastException – The specified cast is not valid.
public override Guid GetGuid(int ordinal) #

When overridden in a derived class, gets the value of the specified column as a globally unique identifier (GUID).

Parameters

ordinal int required
The zero-based column ordinal.

Returns

Guid The value of the specified column.

Exceptions

  • IndexOutOfRangeException – The column index is out of range.
  • InvalidCastException – The specified cast is not valid.
public override short GetInt16(int ordinal) #

When overridden in a derived class, gets the value of the specified column as a 16-bit signed integer.

Parameters

ordinal int required
The zero-based column ordinal.

Returns

short The value of the specified column.

Exceptions

  • IndexOutOfRangeException – The column index is out of range.
  • InvalidCastException – The specified cast is not valid.
public override int GetInt32(int ordinal) #

When overridden in a derived class, gets the value of the specified column as a 32-bit signed integer.

Parameters

ordinal int required
The zero-based column ordinal.

Returns

int The value of the specified column.

Exceptions

  • IndexOutOfRangeException – The column index is out of range.
  • InvalidCastException – The specified cast is not valid.
public override long GetInt64(int ordinal) #

When overridden in a derived class, gets the value of the specified column as a 64-bit signed integer.

Parameters

ordinal int required
The zero-based column ordinal.

Returns

long The value of the specified column.

Exceptions

  • IndexOutOfRangeException – The column index is out of range.
  • InvalidCastException – The specified cast is not valid.
public override string GetName(int ordinal) #

When overridden in a derived class, gets the name of the column, given the zero-based column ordinal.

Parameters

ordinal int required
The zero-based column ordinal.

Returns

string The name of the specified column.
public override int GetOrdinal(string name) #

When overridden in a derived class, gets the column ordinal given the name of the column.

Parameters

name string required
The name of the column.

Returns

int The zero-based column ordinal.

Exceptions

  • IndexOutOfRangeException – The name specified is not a valid column name.
public override DataTable? GetSchemaTable() #

Returns a DataTable that describes the column metadata of the DbDataReader. Returns null if the executed command returned no resultset, or after DbDataReader.NextResult returns false.

Returns

DataTable? A DataTable that describes the column metadata.

Exceptions

  • InvalidOperationException – The DbDataReader is closed.
  • IndexOutOfRangeException – The column index is out of range.
  • NotSupportedException – .NET Core and .NET 5+ only: In all cases.
public override Stream GetStream(int ordinal) #

Gets a stream to retrieve data from the specified column.

Parameters

ordinal int required
The zero-based column ordinal.

Returns

Stream A stream.

Exceptions

  • InvalidOperationException – The connection was dropped or closed during the data retrieval. -or- The data reader is closed during the data retrieval. -or- There is no data ready to be read (for example, the first DbDataReader.Read hasn't been called, or returned false). -or- The data reader tried to read a previously-read column in sequential mode. -or- There was an asynchronous operation in progress. This applies to all Get* methods when running in sequential mode, as they could be called while reading a stream.
  • IndexOutOfRangeException – The column index is out of range.
  • InvalidCastException – The specified column isn't a binary type that supports reading with a Stream.
public override string GetString(int ordinal) #

When overridden in a derived class, gets the value of the specified column as an instance of string.

Parameters

ordinal int required
The zero-based column ordinal.

Returns

string The value of the specified column.

Exceptions

  • IndexOutOfRangeException – The column index is out of range.
  • InvalidCastException – The specified cast is not valid.
public override object GetValue(int ordinal) #

When overridden in a derived class, gets the value of the specified column as an instance of object.

Parameters

ordinal int required
The zero-based column ordinal.

Returns

object The value of the specified column.

Exceptions

  • IndexOutOfRangeException – The column index is out of range.
public override int GetValues(object[] values) #

When overridden in a derived class, populates an array of objects with the column values of the current row.

Parameters

values object[] required
An array of object into which to copy the attribute columns.

Returns

int The number of instances of object in the array.
public override bool IsDBNull(int ordinal) #

When overridden in a derived class, gets a value that indicates whether the column contains nonexistent or missing values.

Parameters

ordinal int required
The zero-based column ordinal.

Returns

bool true if the specified column is equivalent to DBNull; otherwise, false.

Exceptions

  • IndexOutOfRangeException – The column index is out of range.
public bool IsSpecified(int ordinal) #

Distinguishes an omitted input value from an explicit null.

Parameters

ordinal int required

Returns

bool
public override bool NextResult() #

When overridden in a derived class, advances the reader to the next result when reading the results of a batch of statements.

Returns

bool true if there are more result sets; otherwise, false.
public override bool Read() #

When overridden in a derived class, advances the reader to the next record in a result set.

Returns

bool true if there are more rows; otherwise, false.
public override Task<bool> ReadAsync(CancellationToken cancellationToken) #

Asynchronously advances the reader to the next record in a result set.

Parameters

cancellationToken System.Threading.CancellationToken required
The cancellation instruction.

Returns

Task<bool> A Task<T> whose Task<T>.Result property is true if there are more rows or false if there aren't.

Exceptions

  • DbException – An error occurred while executing the command text.

Properties

public override int FieldCount { get; } #

When overridden in a derived class, gets the number of columns in the current row.

Exceptions

  • NotSupportedException – There is no current connection to an instance of SQL Server.
public override bool HasRows { get; } #

When overridden in a derived class, gets a value that indicates whether this DbDataReader contains one or more rows.

public override bool IsClosed { get; } #

When overridden in a derived class, gets a value indicating whether the DbDataReader is closed.

Exceptions

  • InvalidOperationException – The DbDataReader is closed.
public override int Depth { get; } #

Gets a value indicating the depth of nesting for the current row.

public override int RecordsAffected { get; } #

When overridden in a derived class, gets the number of rows changed, inserted, or deleted by execution of the SQL statement.

public override object this[int ordinal] { get; } #

When overridden in a derived class, gets the value of the specified column as an instance of object.

Parameters

ordinal int required
The zero-based column ordinal.

Exceptions

  • IndexOutOfRangeException – The column index is out of range.
public override object this[string name] { get; } #

When overridden in a derived class, gets the value of the specified column as an instance of object.

Parameters

name string required
The name of the column.

Exceptions

  • IndexOutOfRangeException – No column with the specified name was found.