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 - C 及 C++ 编程 » 应用程序开发 » 使用 UltraLite C++ API 开发应用程序 » 使用 Table API 访问数据

 

插入行

插入行的步骤与更新行的步骤非常相似,区别在于无需在执行插入操作之前在表中定位行。由于始终根据索引在数据库中插入数据,因此在表中插入行的顺序无关紧要。

示例

以下代码段用于插入一个新行。

tbl.InsertBegin();
tbl.Set( UL_TEXT("id"), 3 );
tbl.Set( UL_TEXT("lname"), "Carlo" );
tbl.Insert();
tbl.Commit();

如果没有设置其中一列的值,并且该列有缺省值,则使用该缺省值。如果该列没有缺省值,将使用以下条目之一: