DbEnumerator 类

定义

公开 GetEnumerator() 方法,该方法支持 .NET Framework 数据提供程序对集合进行简单的迭代。Exposes the GetEnumerator() method, which supports a simple iteration over a collection by a .NET Framework data provider.

public ref class DbEnumerator : System::Collections::IEnumerator
public class DbEnumerator : System.Collections.IEnumerator
type DbEnumerator = class
    interface IEnumerator
Public Class DbEnumerator
Implements IEnumerator
继承
DbEnumerator
实现

注解

DbEnumerator类由 .NET Framework 数据提供程序实现, 以提供数据绑定支持。The DbEnumerator class is implemented by a .NET Framework data provider to provide data binding support.

按照设计, DbEnumerator对象只与一个结果集一起使用。By design, the DbEnumerator object is intended for use with only one resultset. 例如, 如果执行包含两个返回不同架构的 SQL SELECT 语句的批处理语句, 则第二条语句可能不会返回整个架构。For example, if you execute a batch statement containing two SQL SELECT statements that return different schemas, the second statement might not retun the entire schema. 若要避免这种情况, DbEnumerator请获取每个结果集的, NextResult然后调用 .NET Framework 数据提供程序 DataReader 对象的方法。To avoid this situation, obtain a DbEnumerator for each resultset, and then call the NextResult method of a .NET Framework data provider DataReader object.

构造函数

DbEnumerator(DbDataReader)

使用给定的数据读取器初始化 DbEnumerator 类的新实例。Initializes a new instance of the DbEnumerator class with the give n data reader.

DbEnumerator(DbDataReader, Boolean)

使用指定的读取器初始化 DbEnumerator 类的新实例,并表示在循环访问读取器的数据后是否将其自动关闭。Initializes a new instance of the DbEnumerator class using the specified reader and indicates whether to automatically close the reader after iterating through its data.

DbEnumerator(IDataReader)

使用指定的 DbEnumerator 初始化 DataReader 类的新实例。Initializes a new instance of the DbEnumerator class using the specified DataReader.

DbEnumerator(IDataReader, Boolean)

使用指定的 DataReader 初始化 DbEnumerator 类的新实例,并指示在循环访问 DataReader 的数据后是否将其自动关闭。Initializes a new instance of the DbEnumerator class using the specified DataReader, and indicates whether to automatically close the DataReader after iterating through its data.

属性

Current

获取集合中的当前元素。Gets the current element in the collection.

方法

Equals(Object)

确定指定的对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(继承自 Object)
GetHashCode()

用作默认哈希函数。Serves as the default hash function.

(继承自 Object)
GetType()

获取当前实例的 TypeGets the Type of the current instance.

(继承自 Object)
MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(继承自 Object)
MoveNext()

将枚举数推进到集合的下一个元素。Advances the enumerator to the next element of the collection.

Reset()

将枚举数设置为其初始位置,该位置位于集合中第一个元素之前。Sets the enumerator to its initial position, which is before the first element in the collection.

ToString()

返回一个表示当前对象的 string。Returns a string that represents the current object.

(继承自 Object)

适用于

另请参阅