Database Object |
home |
SQLXL | ||
Database | ||
Parameters |
The Database object encapsulates all the functionality to do with the the database as a whole. This is mainly connecting and disconnecting to the database and performing commits and rollbacks.
Name | Data Type | Description |
Connected | As Boolean | Connected is True when SQL*XL is currently connected to the database and False when it is not connected. |
ConnectionType | As Long | (ReadOnly) litOO4O for Oracle Object for OLE connections or litSQLXLADO for all ADO connections. |
Database | As String | Name of the database of the current connection. If Connected = False this property will be "". |
UserName | As String | The user who currently connected to the datbase. If Connected = False this property will be "". |
Name | Parameters | Description |
Commit | Close the current transaction by saving the changes if any. Start a new transaction after the commit. | |
Connect | UserName As String PassWord As String DBAlias As String ConnectionType As Long Optional ConnectionString As String Optional AllowTransactions As Boolean |
Connects SQL*XL to the database using the following connect string: username/password@dbalias. Set the ConnectionType to litOO4O or litSQLXLADO in order to make a connection using OO4O or ADO respectively. Check the Connected property to check whether the connect was successful. For ADO connections also use the optional ConnectionString parameter. The AllowTransactions parameter can be used to switch off transaction support. |
DisConnect | Disconnects from the database. Use the Connected property to check whether SQL*XL is logged on. | |
Rollback | Close the current transaction by rolling back all changes. Start a new transaction after the rollback. |
Issue a commit and disconnect from the database:
SQLXL.Database.Commit SQLXL.Database.DisConnect
Connect to a database using ADO:
SQLXL.Database.InitialiseSQLXL SQLXL.Database.Connect UserName:="scott", Password:="tiger", DBAlias:="", ConnectionType:=litSQLXLADO, ConnectionString:="Provider=OraOLEDB.Oracle.1;Persist Security Info=False;User ID=scott;Data Source="""";Extended Properties=""""", AllowTransactions:=True