Android Sqlite: last_insert_rowid() after insert -


i want last_insert_rowid() after insert statement.

i wanted use sqlitedatabase.execsql() says can't use select statements there.

how can use last_insert_rowid()?

i think have used method insert data in sqlite database give new inserted row.

no need use method.

public long insert (string table, string nullcolumnhack, contentvalues values)

parameters

table table insert row into

nullcolumnhack optional; may null. sql doesn't allow inserting empty row without naming @ least 1 column name. if provided values empty, no column names known , empty row can't inserted. if not set null, nullcolumnhack parameter provides name of nullable column name explicitly insert null in case values empty.

values map contains initial column values row. keys should column names , values column values

it returns row id of newly inserted row, or -1 if error occurred

like:

long = database.insert("animals", null, values); 

a table's row id.


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -