DbDataReader.GetTextReader(Int32) 方法

定义

获取文本读取器以从列中检索数据。Gets a text reader to retrieve data from the column.

public:
 virtual System::IO::TextReader ^ GetTextReader(int ordinal);
public virtual System.IO.TextReader GetTextReader (int ordinal);
abstract member GetTextReader : int -> System.IO.TextReader
override this.GetTextReader : int -> System.IO.TextReader
Public Overridable Function GetTextReader (ordinal As Integer) As TextReader

参数

ordinal
Int32

从零开始的列序号。The zero-based column ordinal.

返回

TextReader

文本读取器。A text reader.

例外

在数据检索期间删除或关闭连接。The connection was dropped or closed during the data retrieval.

- 或 --or-

在数据检索期间关闭数据读取器。The data reader is closed during the data retrieval.

- 或 --or-

没有要读取的就绪数据 (例如,第一个 Read() 未被调用或返回错误)。There is no data ready to be read (for example, the first 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. 以顺序模式运行时,这适用于所有 Get* 方法,读取流时也可对其进行调用。This applies to all Get* methods when running in sequential mode, as they could be called while reading a stream.

列索引超出范围。The column index is out of range.

指定的列不是支持用 TextReader 读取的文本类型。The specified column isn't a text type that supports reading with a TextReader.

注解

GetTextReader 仅支持检索可转换为字符数组 (字符串) 的值。GetTextReader only supports the retrieval of values that can be converted to character arrays (strings).

适用于