Platforms to show: All Mac Windows Linux Cross-Platform
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/Sybase Connect
This example is the version from Thu, 4th Jul 2018.
Project "Sybase Connect.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Löschen"
Const kFileQuit = "Beenden"
Const kFileQuitShortcut = ""
EventHandler Sub Open()
dim con as new SQLConnectionMBS
try
// where is the library?
// optionally pass paths to databases...
#if false // targetWindows then
con.SetFileOption(con.kOptionLibrarySybaseComn, GetFolderItem("libsybcomn.dll"))
con.SetFileOption(con.kOptionLibrarySybaseCS, GetFolderItem("libsybcs.dll"))
con.SetFileOption(con.kOptionLibrarySybaseCT, GetFolderItem("libsybct.dll"))
con.SetFileOption(con.kOptionLibrarySybaseIntl, GetFolderItem("libsybintl.dll"))
con.SetFileOption(con.kOptionLibrarySybaseTCL, GetFolderItem("libsybtcl.dll"))
#endif
// connect to database
// in this example it is Sybase,
// but can also be Firebird/InterBase, Informix, DB2, MySQL
// SQLServer, SQLBase and ODBC
// Read more here: http://www.sqlapi.com/ServerSpecific/Sybase.html
// Please enter values for your server here:
dim ConnectionString as string = "server@database"
// One of the following formats:
// "" or "@" - empty string or '@' character, connects to a default database on a default server.
// <database name> or @ <database name>- connects to a database with the specified name on your default server.
// <server name>@- connects to a default database on the specified server.
// <server name>@<database name> - connects to a database with the specified name on the specified server.
dim username as string = "xxx"
dim password as string = "xxx"
con.Connect(ConnectionString, username, password, SQLConnectionMBS.kSybaseClient)
MsgBox "We are connected!"
// Disconnect is optional
// autodisconnect will occur in destructor if needed
con.Disconnect
msgbox "We are disconnected!"
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 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
The items on this page are in the following plugins: MBS SQL Plugin.