I've created a HTML/JS project in Titanium to develop a desktop app, and have the following code to add data to a sqlite table:
var db = Ti.Database.install('/data/', 'fyw');
db.execute('INSERT INTO newtable (col1, col2, col3, col4) VALUES (?,?,?,?)', 'col1', 'col2', 'col3', 'col4');
Titanium.API.info('JUST INSERTED, lastInsertRowId = ' + db.lastInsertRowId);
db.close();
The code is wrapped in a try...catch and the error I get is "undefined". How can I add a row, then get the id (it's an autoincrement field) which I need to use further down the code?
Thanks,
Adrian