다음을 통해 공유


SQLiteDatabase.LastInsertRowId Property

Definition

Return the "rowid" of the last row to be inserted on the current connection.

public virtual long LastInsertRowId { [Android.Runtime.Register("getLastInsertRowId", "()J", "GetGetLastInsertRowIdHandler", ApiSince=35)] get; }
[<get: Android.Runtime.Register("getLastInsertRowId", "()J", "GetGetLastInsertRowIdHandler", ApiSince=35)>]
member this.LastInsertRowId : int64

Property Value

The ROWID of the last row to be inserted under this connection.

Attributes

Remarks

Return the "rowid" of the last row to be inserted on the current connection. This method must only be called when inside a transaction. IllegalStateException is thrown if the method is called outside a transaction. If the function is called before any inserts in the current transaction, the value returned will be from a previous transaction, which may be from a different thread. If no inserts have occurred on the current connection, the function returns 0. See the SQLite documentation for the specific details.

Java documentation for android.database.sqlite.SQLiteDatabase.getLastInsertRowId().

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to