SQLiteDatabase.LastRowID

From Xojo Documentation

You are currently browsing the old Xojo documentation site. Please visit the new Xojo documentation site!
Method

SQLiteDatabase.LastRowID() As Int64

New in 5.5

Supported for all project types and targets.

Returns an Int64 containing the value of the last RowID added to any table in the database.

Example

This example gets the last rowid of a row added to the team table in an previously connected database:

Try
db.ExecuteSQL("INSERT INTO team (Name, Coach) VALUES ('Penguins', 'Coach Mike')")
Var rowID As Int64
rowID = db.LastRowID
Catch error As DatabaseException
MessageBox("Insert failed. Error: " + error.Message
End Try