MSSQLServerDatabase

From Xojo Documentation
Jump to: navigation, search

Class (inherits from Database)

Used to connect to MS SQL Server databases.

Properties
DatabaseName ErrorMessage ReadOnlyProperty.png Port
Error ReadOnlyProperty.png Host Timeout
ErrorCode ReadOnlyProperty.png Password UserName


Methods
Close GetAffectedRows Rollback
Commit IndexSchema SQLExecute
Connect InsertRecord SQLSelect
FieldSchema Prepare TableSchema

Notes

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.

Threading

SQLSelect and SQLExecute statements do not block when called from within Threads.

Examples

To connect to a local MS SQL Server database:

Dim db As New MSSQLServerDatabase

db.Host = "192.168.0.1\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"

If db.Connect Then
//proceed with database operations
Else
MsgBox("Connection error:" + db.ErrorMessage)
End If

See Also

Database Class, PreparedSQLStatement, MSSQLServerPreparedStatement, RecordSet classes

Personal tools
Namespaces

Variants
Actions
Main
Content
Starting Out
Dig Deeper
More Help
Toolbox
About