Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 11.0.1 (中文) » UltraLite - .NET 编程 » UltraLite .NET 2.0 API 参考 » ULCommand 类 » ExecuteReader 方法

 

ExecuteReader() 方法

执行 SQL SELECT 语句并返回结果集。

语法
Visual Basic
Public Function ExecuteReader() As ULDataReader
C#
public ULDataReader ExecuteReader();
返回值

ULDataReader 对象形式的结果集。

注释

该语句就是当前的 ULCommand 对象,它具有必需的 ULCommand.CommandText 和任何 ULCommand.Parameters。ULDataReader 对象为只读结果集。要获得可编辑的结果集,请使用 ULCommand.ExecuteResultSet()、ULCommand.ExecuteTable() 或 ULDataAdapter。

如果 ULCommand.CommandType 为 System.Data.CommandType.TableDirect,则 ExecuteReader 会执行 ULCommand.ExecuteTable() 并返回一个转换为 ULDataReader 的 ULTable。

出于性能原因,SELECT 语句在缺省情况下标记为只读。如果要将该查询用于执行更新,则此语句必须以 "FOR UPDATE" 作为结尾。

这是 System.Data.IDbCommand.ExecuteReader() 和 System.Data.Common.DbCommand.ExecuteReader() 的强类型版本。

另请参见