SqlDataReader 成员

提供一种从 SQL Server 数据库读取行的只进流的方式。无法继承此类。

下表列出了由 SqlDataReader 类型公开的成员。

公共属性

(请参见 受保护的属性 )

  名称 说明
Public property Supported by the .NET Compact Framework Depth 已重写。获取一个值,用于指示当前行的嵌套深度。
Public property Supported by the .NET Compact Framework FieldCount 已重写。获取当前行中的列数。
Public property HasRows 已重写。获取一个值,该值指示 SqlDataReader 是否包含一行或多行。
Public property Supported by the .NET Compact Framework IsClosed 已重写。检索一个布尔值,该值指示是否已关闭指定的 SqlDataReader 实例。
Public property Supported by the .NET Compact Framework Item 已重载。 已重写。获取以本机格式表示的列的值。
Public property Supported by the .NET Compact Framework RecordsAffected 已重写。获取执行 Transact-SQL 语句所更改、插入或删除的行数。
Public property VisibleFieldCount 已重写。获取 SqlDataReader 中未隐藏的字段的数目。

页首

受保护的属性

  名称 说明
Protected property Connection 获取与 SqlDataReader 关联的 SqlConnection

页首

公共方法

(请参见 受保护的方法 )

  名称 说明
Public method Supported by the .NET Compact Framework Close 已重写。 关闭 SqlDataReader 对象。
Public method CreateObjRef  创建一个对象,该对象包含生成用于与远程对象进行通信的代理所需的全部相关信息。 (从 MarshalByRefObject 继承。)
Public method Dispose  已重载。 释放由 DbDataReader 占用的资源。 (从 DbDataReader 继承。)
Public method Supported by the .NET Compact Framework Equals  已重载。 确定两个 Object 实例是否相等。 (从 Object 继承。)
Public method Supported by the .NET Compact Framework GetBoolean 已重写。 获取指定列的布尔值形式的值。
Public method Supported by the .NET Compact Framework GetByte 已重写。 获取指定列的字节形式的值。
Public method Supported by the .NET Compact Framework GetBytes 已重写。 从指定的列偏移量将字节流读入缓冲区,并将其作为从给定的缓冲区偏移量开始的数组。
Public method Supported by the .NET Compact Framework GetChar 已重写。 获取指定列的单个字符串形式的值。
Public method Supported by the .NET Compact Framework GetChars 已重写。 从指定的列偏移量将字符流作为数组从给定的缓冲区偏移量开始读入缓冲区。
Public method Supported by the .NET Compact Framework GetData  返回被请求的列序号的 DbDataReader 对象。 (从 DbDataReader 继承。)
Public method Supported by the .NET Compact Framework GetDataTypeName 已重写。 获取源数据类型的名称。
Public method Supported by the .NET Compact Framework GetDateTime 已重写。 获取指定列的 DateTime 对象形式的值。
Public method Supported by the .NET Compact Framework GetDecimal 已重写。 获取指定列的 Decimal 对象形式的值。
Public method Supported by the .NET Compact Framework GetDouble 已重写。 获取指定列的双精度浮点数形式的值。
Public method GetEnumerator 已重写。 返回循环访问 SqlDataReaderIEnumerator
Public method Supported by the .NET Compact Framework GetFieldType 已重写。 获取是对象的数据类型的 Type
Public method Supported by the .NET Compact Framework GetFloat 已重写。 获取指定列的单精度浮点数形式的值。
Public method Supported by the .NET Compact Framework GetGuid 已重写。 获取指定列的值作为全局唯一标识符 (GUID)。
Public method Supported by the .NET Compact Framework GetHashCode  用作特定类型的哈希函数。GetHashCode 适合在哈希算法和数据结构(如哈希表)中使用。 (从 Object 继承。)
Public method Supported by the .NET Compact Framework GetInt16 已重写。 获取指定列的 16 位有符号整数形式的值。
Public method Supported by the .NET Compact Framework GetInt32 已重写。 获取指定列的 32 位有符号整数形式的值。
Public method Supported by the .NET Compact Framework GetInt64 已重写。 获取指定列的 64 位有符号整数形式的值。
Public method GetLifetimeService  检索控制此实例的生存期策略的当前生存期服务对象。 (从 MarshalByRefObject 继承。)
Public method Supported by the .NET Compact Framework GetName 已重写。 获取指定列的名称。
Public method Supported by the .NET Compact Framework GetOrdinal 已重写。 在给定列名称的情况下获取列序号。
Public method GetProviderSpecificFieldType 已重写。 获取一个 Object,它表示基础提供程序特定的字段类型。
Public method GetProviderSpecificValue 已重写。 获取一个表示基础提供程序特定值的 Object
Public method GetProviderSpecificValues 已重写。 获取表示基础提供程序特定值的对象的数组。
Public method Supported by the .NET Compact Framework GetSchemaTable 已重写。 返回一个 DataTable,它描述 SqlDataReader 的列元数据。
Public method Supported by the .NET Compact Framework GetSqlBinary 获取指定列的 SqlBinary 形式的值。
Public method Supported by the .NET Compact Framework GetSqlBoolean 获取指定列的 SqlBoolean 形式的值。
Public method Supported by the .NET Compact Framework GetSqlByte 获取指定列的 SqlByte 形式的值。
Public method GetSqlBytes 获取指定列的 SqlBytes 形式的值。
Public method GetSqlChars 获取指定列的 SqlChars 形式的值。
Public method Supported by the .NET Compact Framework GetSqlDateTime 获取指定列的 SqlDateTime 形式的值。
Public method Supported by the .NET Compact Framework GetSqlDecimal 获取指定列的 SqlDecimal 形式的值。
Public method Supported by the .NET Compact Framework GetSqlDouble 获取指定列的 SqlDouble 形式的值。
Public method Supported by the .NET Compact Framework GetSqlGuid 获取指定列的 SqlGuid 形式的值。
Public method Supported by the .NET Compact Framework GetSqlInt16 获取指定列的 SqlInt16 形式的值。
Public method Supported by the .NET Compact Framework GetSqlInt32 获取指定列的 SqlInt32 形式的值。
Public method Supported by the .NET Compact Framework GetSqlInt64 获取指定列的 SqlInt64 形式的值。
Public method Supported by the .NET Compact Framework GetSqlMoney 获取指定列的 SqlMoney 形式的值。
Public method Supported by the .NET Compact Framework GetSqlSingle 获取指定列的 SqlSingle 形式的值。
Public method Supported by the .NET Compact Framework GetSqlString 获取指定列的 SqlString 形式的值。
Public method Supported by the .NET Compact Framework GetSqlValue 获取一个表示基础 SqlDbType 变量的 Object
Public method Supported by the .NET Compact Framework GetSqlValues 获取当前行中的所有属性列。
Public method GetSqlXml 获取指定列的 XML 值形式的值。
Public method Supported by the .NET Compact Framework GetString 已重写。 获取指定列的字符串形式的值。
Public method Supported by the .NET Compact Framework GetType  获取当前实例的 Type。 (从 Object 继承。)
Public method Supported by the .NET Compact Framework GetValue 已重写。 获取以本机格式表示的指定列的值。
Public method Supported by the .NET Compact Framework GetValues 已重写。 获取当前行的集合中的所有属性列。
Public method InitializeLifetimeService  获取控制此实例的生存期策略的生存期服务对象。 (从 MarshalByRefObject 继承。)
Public method Supported by the .NET Compact Framework IsDBNull 已重写。 获取一个值,用于指示列中是否包含不存在的或缺少的值。
Public method Supported by the .NET Compact Framework NextResult 已重写。 当读取批处理 Transact-SQL 语句的结果时,使数据读取器前进到下一个结果。
Public method Supported by the .NET Compact Framework Read 已重写。 使 SqlDataReader 前进到下一条记录。
Public method Static Supported by the .NET Compact Framework ReferenceEquals  确定指定的 Object 实例是否是相同的实例。 (从 Object 继承。)
Public method Supported by the .NET Compact Framework ToString  返回表示当前 ObjectString。 (从 Object 继承。)

页首

受保护的方法

  名称 说明
Protected method Dispose  已重载。 释放由 DbDataReader 占用的资源。 (从 DbDataReader 继承。)
Protected method Supported by the .NET Compact Framework Finalize  允许 Object 在“垃圾回收”回收 Object 之前尝试释放资源并执行其他清理操作。 (从 Object 继承。)
Protected method GetDbDataReader  返回被请求的列序号的 DbDataReader 对象,可以使用提供程序特定的实现对该对象进行重写。 (从 DbDataReader 继承。)
Protected method IsCommandBehavior 确定指定的 CommandBehavior 是否与 SqlDataReader 的对应项匹配。
Protected method Supported by the .NET Compact Framework MemberwiseClone  已重载。 (从 MarshalByRefObject 继承。)

页首

显式接口实现

  名称 说明
Explicit interface implementation Method Supported by the .NET Compact Framework System.Collections.IEnumerable.GetEnumerator  
Explicit interface implementation Method System.Data.IDataRecord.GetData 有关此成员的说明,请参见 GetData
Explicit interface implementation Method Supported by the .NET Compact Framework System.IDisposable.Dispose  

页首

请参见

参考

SqlDataReader 类
System.Data.SqlClient 命名空间

其他资源

在 ADO.NET 中连接和检索数据
使用 SQL Server .NET Framework 数据提供程序