I have the following code that read a table, which has some field added, which need to be changed on the first run.
[code] dim sql as String = “Select * FROM service”
// run the query
dim rs as RecordSet = gDB.SQLSelect(sql)
if gDB.error then — whatever
while rs <> nil and rs.eof <> true
‘’ ******* fix cost ***** This should only update records once
if db = 0 then if val(rs.field("ST_cost").StringValue) <> 0 then rs.edit if gDB.error then --- whatever rs.field("ST_cost_parts").StringValue = rs.field("ST_cost").StringValue rs.Update//check for error if gDB.error then --- whatever // Commit changes to the database gDB.Commit//check for error if gDB.Error then MsgBox "Error Commit service list: "+gdb.ErrorMessage [/code]
I get SQLite error" cannot commit - no transaction is active"
this ran ok on RealSQL
If I add
"Select rowid, * FROM service"
result are the same, error.
if I add
gDB.sqlExecute "begin transaction"//check for error
just before the rs.edit I do NOT get the error.
NOTE NOTE: In all cases the update WORKED! The database was updated with the change.
My question: Do I need the “commit” statement. My understanding was that for the edit/update needed it to actually do the update.