Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.
UL Ext: 返回最近使用的标识值。
Public ReadOnly Property LastIdentity As ULong
public ulong LastIdentity {get;}
ULException 类 发生 SQL 错误。
最近使用的 unsigned long 类型标识值。
最近使用的标识值。此属性等效于以下 SQL Anywhere 语句:
SELECT @identity
LastIdentity 在全局自动增量列的上下文中尤为有用。
由于此属性仅允许您确定最近指派的缺省值,因此您应在执行插入语句后尽快检索此值,以避免得到虚假结果。
有时,单个插入语句可能会包括类型为全局自动增量的多个列。在这种情况下,LastIdentity 是生成的缺省值之一,但没有可靠的方法能确定该值来自哪一列。因此,在设计数据库和编写插入语句时,应避免这种情况。