DBConnect Method Example
The following example is a script associated with a command button. When you click the button in the run-time environment, the script sets properties and methods for the Data ObjectvxData1. The script disconnects from the current data provider and configures vxData1 to connect to the Northwind database of SQL Server QALAB15. Then it connects to the database and runs a query that returns the rows and columns of the Employees table.
Private Sub CommandButton1_Click()
vxData1.DBDisconnect
vxData1.OLEDBProvider = "SQLOLEDB"
vxData1.Server = "QALAB15"
vxData1.Database = "NORTHWIND"
vxData1.SourceType = vxSourceTable
vxData1.Table = "Employees"
vxData1.User = "sa"
vxData1.DBConnect
End Sub
NOTES (CIMPLICITY USERS ONLY):
- The name of the subroutine shown here follows standard VBA naming convention, which does not apply to CimEdit Basic script language.
- In CIMPLICITY, the following additional code must precede the first reference of vxData1 in its scope:
Dim vxData1 As Object
Set vxData1 = CimGetScreen.Object.Objects.Item("vxData1").OleObject