Delete Data

If I am using the following code to save Preferences,

Dim dr as new DatabaseRecord dr.column("Currency") = trim(popupmenucurrency.text) dr.column("measurement") = trim(popupmenumeasurement.text) dr.column("temperature") = trim(popupmenutemperature.text) karter.InsertRecord "preferences",dr karter.Commit msgbox"Preferences have been Saved"

How do I Delete the previous record before it saves the new record, so there is always only one set of preferences in the database.


run one statement
karter.sqlexecute(“delete from preferences”)

BUT I would wrap the delete & insert in one transaction so they either both happen or don’t

Thanks Norman.

another option is to update the existing record if it exists over delete/adding a new one.

if you download MBS Plugins, there is an example: Preferences with local Database.rbp

you can read it here online: