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 参考 » ULConnection 类

 

LastIdentity 属性

UL Ext.: 返回最近使用的标识值。

语法
Visual Basic
Public Readonly Property LastIdentity As UInt64
C#
public ulong LastIdentity { get;}
属性值

最近使用的 unsigned long 类型标识值。

注释

最近使用的标识值。此属性等效于以下 SQL Anywhere 语句:

SELECT @@identity

LastIdentity 在全局自动增量列的上下文中尤为有用。

由于此属性仅允许您确定最近指派的缺省值,因此您应在执行插入语句后尽快检索此值,以避免得到虚假结果。

有时,单个插入语句可能会包括类型为全局自动增量的多个列。在这种情况下,LastIdentity 是生成的缺省值之一,但没有可靠的方法能确定该值来自哪一列。因此,在设计数据库和编写插入语句时,应避免这种情况。

另请参见