Okay... 1) use a synchronous connection as async won't work for transactions. 2) yep, use transactions 3) put your statements in an array, not a semi-colon separated string 4) here's the key part of the code I use
connection.begin(); for each (var sqlString:String in sqlArray) { statement.text = sqlString; try { statement.execute(-1); } catch(error:SQLError) { connection.rollback(responder); } } connection.commit(responder); connection.close(); --- In flexcoders@yahoogroups.com, "icodeflex" <icodef...@...> wrote: > > Air and Flex experts- > > I am having a heck of a time getting multiple insert and update statements to run within one transaction against my Air applications SQLite db. Only the first INSERT, UPDATE, or DELETE makes it in. I am not seeing errors, but it seems like it is failing. If I run the same SQL in another SQL editor, my SQL works fine. > > Example code is: > > Var myInsert: String = "Insert into EMPLOYEES ( NAME ) VALUES ("Bob"); "; > myInsert += "Insert into EMPLOYEES ( NAME ) VALUES ("John"); "; > myInsert += "Insert into EMPLOYEES ( NAME ) VALUES ("Fred"); "; > > > var localConnection : SQLConnection = new SQLConnection(); > localConnection.open("myDatabase"); > localConnection.begin(); > > var statement: SQLStatement = new SQLStatement(); > statement.sqlConnection = localConnection; > statement.text = myInsert; > statement.execute(); > > localConnection.commit(); > > I have tried in synchronous and async mode with the same results. > > Please tell me what I am doing wrong! :) > > Thanks! > Dustin >