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

SQL Anywhere 11.0.1 (中文) » SQL Anywhere 服务器 - 编程 » SQL Anywhere 数据访问 API » SQL Anywhere .NET 2.0 API 参考 » iAnywhere.Data.SQLAnywhere 命名空间 (.NET 2.0) » SACommandBuilder 类 » GetUpdateCommand 方法

 

GetUpdateCommand(Boolean) 方法

返回调用 Update 时生成的、对数据库执行 UPDATE 操作的 SACommand 对象。

语法
Visual Basic

Public Function GetUpdateCommand( _
   ByVal useColumnsForParameterNames As Boolean _
) As SACommand
C#

public SACommand GetUpdateCommand(
   bool useColumnsForParameterNames
);
参数
  • useColumnsForParameterNames   如果为 true,则在可能的情况下生成与列名匹配的参数名。如果为 false,则生成 @p1、@p2 等等。

返回值

自动生成的、执行更新操作所需的 SACommand 对象。

注释

GetUpdateCommand 方法返回要执行的 SACommand 对象,因此它在提供信息或进行疑难解答上可能会有帮助。

也可以将 GetUpdateCommand 用作修改过的命令的基础。例如,您可能会调用 GetUpdateCommand 并修改 CommandTimeout 值,然后在 SADataAdapter 上显式地设置该值。

当应用程序调用 Update 或 GetUpdateCommand 时,将首先生成 SQL 语句。首先生成 SQL 语句后,如果应用程序以任何方式更改了该语句,则其必须显式地调用 RefreshSchema。否则,GetUpdateCommand 将仍然使用来自上一条语句的信息,而这些信息可能是不正确的。

另请参见