Commmit error ?

I’m in the process of changing my application from RealSqlDataBase to SQLiteDatabase and have run into a problem in my record delete routing.
Here is the code:

// find the record to delete dim sql as String = "SELECT name FROM Members WHERE name = '" + EscapeSQLData(aMembersName) + "'" dim rs as RecordSet = gDB.SQLSelect(sql) if rs = nil or rs.EOF then MsgBox "Couldn't find Member in database: " + gDB.ErrorMessage+ EndOfLine + CurrentMethodName return end if // delete the record rs.DeleteRecord // make the change permanent gDB.Commit //check for error if gDB.Error then MsgBox "Error deleting Members record: " + gDB.ErrorMessage+ EndOfLine + CurrentMethodName end if

I get the following error:
Error deleting Members record: cannot commit - no transaction is active
winMembers.RecordDelete

However the record is deleted.

If I remove the “gDB.Commit” line of code the record is deleted and I get no error.

My question is: Am I OK in doing this, or is there something else I need to do.

You’ll need to begin the transaction first i believe.

gDB.SQLExecute("BEGIN TRANSACTION")

Thanks! That did it.

Or, remove the Commit line as it’s not needed.

Hello all,
Was this a changed following the intro of Xojo as compared with RS?

Also is this required for

  1. All database managers- MySql, PervasiveSQL, PostgreSQL Etc?
  2. All inserts, deletes, edits etc to any database?

Thanks all!
Tim

It changed with the introduction of SQLiteDatabase as opposed to RealSQLDatabase.

Hi Tim,

It is not a requirement for Sqlite as you stated, but is it a requirement for the other db’s - postgres, mysql etc?
Tim

Yes. The other db’s have not changed. Just SQLiteDatabase.