Xojo Conferences
MBSSep2018MunichDE
XDCMay2019MiamiUSA

Platforms to show: All Mac Windows Linux Cross-Platform

/SQL/SQLDatabaseMBS Microsoft SQL via ODBC
Function:
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/SQLDatabaseMBS Microsoft SQL via ODBC
This example is the version from Sat, 31th Oct 2014.
Project "SQLDatabaseMBS Microsoft SQL via ODBC.rbp"
Class App Inherits Application
Const kEditClear = "&Löschen"
Const kFileQuit = "Beenden"
Const kFileQuitShortcut = ""
End Class
Class Window1 Inherits Window
Control PushButton1 Inherits PushButton
ControlInstance PushButton1 Inherits PushButton
EventHandler Sub Action() dim con as new SQLDatabaseMBS try // we used Microsoft SQL Server 2008 and run app on Windows to test this con.Option("UseAPI") = "ODBC" con.DatabaseName = "ODBC:"+TextField1.Text if con.Connect then con.Scrollable = false // disabling scrolling cursors is much faster for Microsoft SQL Server... con.RaiseExceptions = true // if you like to get exceptions instead of checking error property // go to database test con.SQLExecute "use test" // select names from test table dim r as RecordSet = con.SQLSelect("select * from dbo.test") while not r.EOF MsgBox r.Field("name").StringValue r.MoveNext wend // Disconnect is optional // autodisconnect will ocur in destructor if needed con.close msgbox "We are disconnected!" end if catch r as RuntimeException MsgBox r.message // SAConnection::Rollback() // can also throw an exception // (if a network error for example), // we will be ready try // on error rollback changes con.Rollback catch rr as runtimeexception MsgBox rr.message end try end try End EventHandler
End Control
Control TextField1 Inherits TextField
ControlInstance TextField1 Inherits TextField
End Control
Control Label1 Inherits Label
ControlInstance Label1 Inherits Label
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

See also:

Feedback, Comments & Corrections

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





Links
MBS Xojo Chart Plugins