Xojo Conferences

Platforms to show: All Mac Windows Linux Cross-Platform

/SQL/SQLDatabaseMBS SQL Anywhere Connect
Required plugins for this example: MBS SQL Plugin, MBS Util Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /SQL/SQLDatabaseMBS SQL Anywhere Connect
This example is the version from Sat, 26th Jan 2018.
Project "SQLDatabaseMBS SQL Anywhere Connect.rbp"
Class App Inherits Application
Const kEditClear = "&Löschen"
Const kFileQuit = "Beenden"
Const kFileQuitShortcut = ""
EventHandler Sub Open() dim db as new SQLDatabaseMBS // where is the library? Change this to point to your libraries! // windows: dbcapi.dll // Mac OS X: libdbcapi.dylib // Linux: libdbcapi.so dim file as FolderItem #if TargetWin32 then file = getfolderitem("c:\SQLAnywhere/dbcapi.dll", folderitem.PathTypeShell) #elseif TargetLinux then file = getfolderitem("/SQLAnywhere/libdbcapi.so", folderitem.PathTypeShell) #elseif TargetMachO then file = getfolderitem("/Applications/SQLAnywhere12/System/lib32/libdbcapi.dylib", folderitem.PathTypeShell) #else ? #endif // important to change folder to make sure the files are found. dim folder as FolderItem = file.parent call SQLGlobalsMBS.SetCurrentWorkingDirectory(folder) db.SetFileOption db.kOptionLibrarySQLanywhere, file // connect to database // in this example it is SQL Anywhere, // but can also be Sybase, Oracle, ODBC, SQLite, Informix, DB2, SQLServer, InterBase, MySQL and SQLBase dim path as string = "host=;dbn=demo;uid=dba;pwd=sql" // whatever path the ODBC driver needs db.UserName = "" db.Password = "" db.DatabaseName = "SQLAnywhere:"+path if db.Connect then MsgBox "We are connected!" // Disconnect is optional // autodisconnect will ocur in destructor if needed db.close msgbox "We are disconnected!" end if End EventHandler
End Class
Class Window1 Inherits Window
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.

MBS FileMaker blog