From Xojo Documentation

Revision as of 18:59, 12 November 2019 by PLefebvre (talk | contribs) (Sample Code)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Class (inherits from Database)

New in 2011r1

Used to connect to MS SQL Server databases.

DatabaseName Password Timeout
Host Port UserName
AddRow Connect TableColumns
AffectedRowCount ExecuteSQL TableIndexes
BeginTransaction Prepare Tables
Close RollbackTransaction
CommitTransaction SelectSQL


In order to use this class, you must have the MSSQServerDatabase plug-in in your plugins folder. The plug-in is included in the installation.

When the plug-in is installed, this class becomes available and you can also added a MS SQL Server database connection directly to the project.

This plug-in is a Windows-only feature. Other platforms will get a PlatformNotSupportedException when any method is called.

The MSSQLServerDatabase engine supports only the MoveNext RecordSet navigation method.

Multiple result sets are not supported. If your query returns multiple results sets you will only get back the first result set.


SelectSQL and ExecuteSQL statements do not block when called from within Threads.

Sample Code

To connect to a local MS SQL Server database:

Var db As New MSSQLServerDatabase
db.Host = "\InstanceName" // or just the IP if using the default instance
db.DatabaseName = "NorthWind"
db.UserName = "MyUserID" // or "Domain\UserID for trusted domain accounts
db.Password = "mypassword"
Catch error As DatabaseException
MessageBox("The database connection was unsuccessful.")
End Try

See Also

Database Class, PreparedSQLStatement, MSSQLServerPreparedStatement, RowSet classes