Xojo Developer Conference
25/27th April 2018 in Denver.
MBS Xojo Conference
6/7th September 2018 in Munich, Germany.

Platforms to show: All Mac Windows Linux Cross-Platform

/SQL/SQL Exception Tests
Required plugins for this example: MBS SQL Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /SQL/SQL Exception Tests
This example is the version from Thu, 20th Feb 2013.
Project "SQL Exception Tests.rbp"
Class App Inherits Application
Const kEditClear = "&Löschen"
Const kFileQuit = "Beenden"
Const kFileQuitShortcut = ""
EventHandler Function UnhandledException(error As RuntimeException) As Boolean MsgBox CurrentMethodName+EndOfLine+Introspection.GetType(error).fullname+EndOfLine+error.Message+" ("+str(error.Message.len)+")" Return true End EventHandler
End Class
Class Window1 Inherits Window
Control BevelButton1 Inherits BevelButton
ControlInstance BevelButton1 Inherits BevelButton
EventHandler Sub Action() dim selectCmd as string = "BEGIN WORK" dim updCmd as SQLCommandMBS dim DBConnection as SQLConnectionMBS = nil try // create a new SQLCommandMBS updCmd = new SQLCommandMBS updCmd.connection = DBConnection // this is NIL // execute the command updCmd.ExecuteCommand(selectCmd) catch exc as RuntimeException if exc isA SQLErrorExceptionMBS then dim e as SQLErrorExceptionMBS = SQLErrorExceptionMBS(exc) msgBox "Error opening Transaction:"+endOfLine+_ "Error class: "+str(e.ErrorClass)+endOfLine+_ "Native error: "+str(e.NativeError)+endOfLine+_ "Error position: "+str(e.ErrorPosition)+endOfLine+_ "Error message: "+e.ErrorMessage MsgBox e.ErrorMessage+EndOfLine+e.Message else msgBox "Error:"+str(exc.ErrorNumber)+endOfLine+exc.Message end if end try End EventHandler
End Control
Control BevelButton2 Inherits BevelButton
ControlInstance BevelButton2 Inherits BevelButton
EventHandler Sub Action() try // going through normal plugin exception handling for c++ exceptions SQLGlobalsMBS.RaiseSQLErrorException 1, "Hello World" catch exc as RuntimeException msgBox "Exception:"+str(exc.ErrorNumber)+endOfLine+exc.Message+" ("+str(exc.Message.len)+")" end try End EventHandler
End Control
Control BevelButton3 Inherits BevelButton
ControlInstance BevelButton3 Inherits BevelButton
EventHandler Sub Action() try // raising directly SQLGlobalsMBS.RaiseException "Hello World" catch exc as RuntimeException msgBox "Exception:"+str(exc.ErrorNumber)+endOfLine+exc.Message+" ("+str(exc.Message.len)+")" end try End EventHandler
End Control
End Class
MenuBar MenuBar1
MenuItem FileMenu = "&Ablage"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Bearbeiten"
MenuItem EditUndo = "&Rückgängig"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "&Ausschneiden"
MenuItem EditCopy = "&Kopieren"
MenuItem EditPaste = "&Einfügen"
MenuItem EditClear = "#App.kEditClear"
MenuItem UntitledMenu0 = "-"
MenuItem EditSelectAll = "&Alles auswählen"
End MenuBar
End Project

Feedback, Comments & Corrections

The items on this page are in the following plugins: MBS SQL Plugin.

MBS Xojo PDF Plugins