how to get last inserted row id in sqlite
For this you can use the lastInsertRowId
property of database object.
You can use like:
var x = db.lastInsertRowId;
lastInsertRowId
lastInsertRowId
: NumberThe identifier of the last populated row
Please check this link for more details : Titanium.Database.DB
You may also do:
db.transaction(function(tx) { tx.executeSql("INSERT INTO project (cd, pn) VALUES (?,?)", cast, function(tx, res) { var id = res.insertId; }); });
Thus, getting the result of the successful insert and then its property insertId