DB2 10.5 for Linux, UNIX, and Windows

DB2CommandBuilder.GetInsertCommand 方法

获取在数据库中执行插入所需的自动生成的 DB2Command 对象。

名称空间:
IBM.Data.DB2
组合件:
IBM.Data.DB2(在 IBM.Data.DB2.dll 中)

语法

[Visual Basic]
Public Function GetInsertCommand() As DB2Command

[C#]
public DB2Command
 GetInsertCommand();
[C++]
public: DB2Command
* GetInsertCommand();
[JScript]
public function GetInsertCommand() : DB2Command
;

返回值

执行插入所需的自动生成的 DB2®Command 对象。

注释

可以使用 GetInsertCommand 方法来获取参考或进行故障诊断,因为它返回要执行的 DB2Command 对象。还可以使用 GetInsertCommand 将行插入 DB2DataAdapter。

还可以将 GetInsertCommand 用作已修改命令的基础。例如,可以调用 GetInsertCommand 并修改 DB2Command.CommandTimeout 值,然后在 DB2DataAdapter 上显式设置该值。

在第一次生成 SQL 语句后,如果 RefreshSchema 以任何方式更改该语句,那么必须显式对其进行调用。否则,GetInsertCommand 仍将使用来自先前语句的信息,该信息可能不正确。当应用程序调用 UpdateGetInsertCommand 时,将第一次生成 SQL 语句。