表示具有或不具有 IN 参数的预编译 SQL 语句或查询。此对象可用于多次有效地执行语句或查询。此类无法继承。
Visual Basic Public NotInheritable Class ULCommand Inherits DbCommand Implements ICloneable
C# public sealed class ULCommand: DbCommand, ICloneable
可以直接创建 ULCommand 对象,或使用 ULConnection.CreateCommand 方法创建。此方法可以确保命令在给定的连接上具有执行语句所需的正确事务。
在提交或回退当前事务后,必须重置 ULCommand.Transaction 方法。
ULCommand 使用下列方法在 UltraLite.NET 数据库中执行命令:
方法 |
说明 |
---|---|
ULCommand.ExecuteNonQuery | 执行一条不返回结果集的语句,如 SQL INSERT、DELETE 或 UPDATE 语句。 |
ULCommand.ExecuteReader() | 执行 SQL SELECT 语句并在 ULDataReader 中返回结果集。使用此方法可创建只读结果集。 |
ULCommand.ExecuteResultSet() | UL Ext.: 执行 SQL SELECT 语句并在 ULResultSet 中返回结果集。使用此方法可创建可变结果集。 |
ULCommand.ExecuteScalar | 执行 SQL SELECT 语句并返回单个值。 |
ULCommand.ExecuteTable() | UL Ext.: 在 ULTable 中检索数据库表以便直接进行操作。ULCommand.CommandText 被解释为表的名称,而 ULCommand.IndexName 可用于指定表的排序顺序。ULCommand.CommandType 必须为 System.Data.CommandType.TableDirect。 |
您可重置大多数属性(包括 ULCommand.CommandText)并重新使用 ULCommand 对象。
出于资源管理方面的原因,建议在使用完命令后显式终止这些命令。在 C# 中,您可以使用 using 语句来自动调用 System.ComponentModel.Component.Dispose() 方法或显式调用 System.ComponentModel.Component.Dispose() 方法。在 Visual Basic 中,您将始终显式调用 System.ComponentModel.Component.Dispose() 方法。
Inherits: System.Data.Common.DbCommand
Implements: System.Data.IDbCommand、System.IDisposable
ULCommand 成员
ULCommand 构造函数
CommandText 属性
CommandTimeout 属性
CommandType 属性
Connection 属性
DesignTimeVisible 属性
IndexName 属性
Parameters 属性
Plan 属性
Transaction 属性
UpdatedRowSource 属性
BeginExecuteNonQuery 方法
BeginExecuteReader 方法
Cancel 方法
CreateParameter 方法
EndExecuteNonQuery 方法
EndExecuteReader 方法
ExecuteNonQuery 方法
ExecuteReader 方法
ExecuteResultSet 方法
ExecuteScalar 方法
ExecuteTable 方法
Prepare 方法
Copyright © 2009, iAnywhere Solutions, Inc. - SQL Anywhere 11.0.1 |