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.