DB.ErrorMessage is different from Catch err As DatabaseException?

If DB.Error Then
MsgBox("Errore DB: " + DB.ErrorMessage)
Else
’ No error: code to be continued here
'End If

Catch err As DatabaseException
MessageDialog.Show("Errore DB: " + err.Message)
Return
end try
’ No error: code to be continued here

Which are the differences between these 2 routine ?
One more: i’ve correctly inserted the code to be continued ?
’ No error: code to be continued here

as often, the answer is in the documentation:
http://documentation.xojo.com/api/deprecated/deprecated_class_members/database.error.html

use try catch

set options in analyze warnings and use analyze project.

So the first one is deprecated and yes i’ll use

Try

Catch err As DatabaseException
MessageDialog.Show("Errore DB: " + err.Message)
Return
end Try
’ No error, so i can continue to code

Just a doubt: is it correct to continue to code where i’ve inserted:
’ No error, so i can continue to code
isn’t it ?

Return
’ No error, so i can continue to code
end Try

Probably it’s way better to insert here the code …
After end try i can continue the code but before it should go a message that the execution of the query is it ok, correct ?

you should return a boolean and react if something go wrong.
if you use this method in a loop with many querys and each fail you will get many message pop up’s.

looks like

For i As Integer = 1 To 10
MessageDialog.Show(i.ToString)
Next