DataReaderExtensions.GetStream(DbDataReader, String) 方法

定义

获取从指定列检索数据的流。Gets a stream to retrieve data from the specified column.

public:
[System::Runtime::CompilerServices::Extension]
 static System::IO::Stream ^ GetStream(System::Data::Common::DbDataReader ^ reader, System::String ^ name);
public static System.IO.Stream GetStream (this System.Data.Common.DbDataReader reader, string name);
static member GetStream : System.Data.Common.DbDataReader * string -> System.IO.Stream
<Extension()>
Public Function GetStream (reader As DbDataReader, name As String) As Stream

参数

reader
DbDataReader

要从中获取列值的数据读取器。The data reader to get the column value from.

name
String

列的名称。The name of the column.

返回

Stream

一个流。A stream.

例外

在数据检索期间删除或关闭连接。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 name specified is not a valid column name.

指定的列不是支持用 Stream 读取的二进制类型。The specified column isn't a binary type that supports reading with a Stream.

注解

GetStream 仅支持检索可转换为字节数组的值。GetStream only supports the retrieval of values that can be converted to byte arrays.

适用于