how to get last inserted row id in sqlite

appcelerator, javascript, rowid, sqlite, titanium

Solution

For this you can use the `lastInsertRowId` property of database object.

You can use like:

var x = db.lastInsertRowId;

lastInsertRowId

`lastInsertRowId` : Number

The identifier of the last populated row

Please check this link for more details : Titanium.Database.DB

Problem

``` function insertToProject(cast, pName) { db.execute('INSERT INTO project (cd, pn) VALUES (?,?)', cast, pName); var x = last_insert_rowid(); return x; } ``` I have been trying this using javascript in titanium appcelerator. Can anybody tell me what I am doing wrong?

Original source