SQL Locked Error
I have a db.execute command running that errors every time it is run for the first time:
sqlSelect = db.execute('INSERT INTO…');
sqlSelect.close();
Even if I put a try {} catch(e){} around it I still get an error.
Any ideas?
3 Answers
-
Did you open the database before executing?
I've used this function for all my db insert, delete, update and whatno without any issues. (iphone sdk)
function insertData(){ var db = Titanium.Database.open('some_db'); db.execute('INSERT INTO .....'); db.close(); }
-
Yes, I guess I could open and close the database every time. I just didn't want to do that every time, but I guess if that fixes it…
-
Thanks for the tip that worked.
I will make sure to open and close the database every time it is used from now on. (I don't know why I didn't do that already but that fixed it.)