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

SQL Anywhere 10.0.1 » UltraLite - .NET Programming » UltraLite .NET 1.0 API Reference » ULConnection class

GlobalAutoIncrementUsage property Next Page

LastIdentity property

UL Ext.: Returns the most recent identity value used.


Visual Basic

Public Readonly Property LastIdentity As UInt64


public ulong LastIdentity {get;}

Property value

The most recently-used identity value as an unsigned long.


The most recent identity value used. This property is equivalent to the SQL Anywhere statement:

SELECT @@identity

LastIdentity is particularly useful in the context of global autoincrement columns.

Since this property only allows you to determine the most recently assigned default value, you should retrieve this value soon after executing the insert statement to avoid spurious results.

Occasionally, a single insert statement may include more than one column of type global autoincrement. In this case, LastIdentity is one of the generated default values, but there is no reliable means to determine from which column the value is. For this reason, you should design your database and write your insert statements to avoid this situation.