Typical SQL Method Structure

Hi,

Just wondering what would be a typical SQL request structure with error handling. Here is what I got :

Does that make sense?

[code]Var strSQL As String = “UPDATE inspection.savescaledamages SET” + _
" savescaledamages_dam_uuid = $1" + _
" WHERE savescaledamages_id = $2;"

Var values(1) As Variant
values( 0 ) = dam_UUID
values( 1 ) = id

//Executing the SQL Querry
Try
db.BeginTransaction
db.ExecuteSQL( strSQL, values )
Catch error As DatabaseException
MessageBox("DB Error : " + error.Message )
End Try

//Committing if no error encountered
Try
db.CommitTransaction
Catch error As DatabaseException
db.RollbackTransaction
End Try
[/code]

MessageBoxes are not good, should be add to a message list window which appear at a message.
if there are many errors the user click endless.

if the CommitTransaction fails the user was not informed.

This is way overkill for a single statement. Use transactions for multi-statement blocks. If this transaction fails, there is nothing to roll back.

System — Xojo documentation …

Thank you very much for your feedback!

no … if the database can save the data the user must know it direct. just without ok ok ok ok ok ok ok ok ok ok ok