Creates a new instance of the clsD3Connection class, establishing a connection to the specified data source. The second form of the syntax in for RPC connections only.
Set oConn = object.brOpenConnection( sDomain, sDBMS) Set oConn = object.brOpenConnection( sDomain, [ sConnect], [ sRCatalog, [ sUserId], [ sUserPw], [ sAcntPw] )
Parameter | Description |
---|---|
oConn | An object variable that represents a clsD3Connection object. |
object | An object variable that represents a clsD3Environment object. |
sDomain | A String specifying the domain. Specify "ODBC" for ODBC connections or the empty string " " for RPC connections. |
sDBMS | A String containing the name of the ODBC data source. |
sConnect | A String specifying the type of connection. Can be "ODBC", for a direct connection or "ODBC;" for a DAO connection. For RPC connections, specifies the account name. |
sRCatalog | (Optional) Specifies the Rule catalog name. |
sUserId | (Optional) Specifies the User ID. |
sUserPw | (Optional) Specifies the User ID password. |
sAcntPw | (Optional) Specifies the Account password. |
To force the internal use of the Visual Basic DAO (Data Access Object) connection, use the string "ODBC;" – all upper case. This is the slowest way to communicate with the server, but must be used if any data bound controls of DAO methods, such as DBGrid, are utilized. Also, when using the DAO method for connection, records are limited to 4K (4000 characters) due to internal VB limitations.
For handling larger records, use the direct connection method. Use the connection string, "ODBC" to use the direct connection method. This type of connection is approximately three times faster than the DAO method, but will cause Visual Basic to abort randomly if the developer uses data-bound controls or other DAO objects.
In addition to opening a connection to the database, the casing, currency sign, grouping symbol, and decimal separator are set locally on the D3 database based on the settings of the brCasing, brCurrency, brGrouping and brDecimal properties, respectively.
Sub Main() Dim oEnv As New clsD3Environment Dim oConn1 As clsD3Connection Dim oConn2 As clsD3Connection ' Environment settings oEnv.brCurrency = "$" oEnv.brDecimal = "." oEnv.brGrouping = "," oEnv.brCasing = False ' oConn1 will inherit environment settings Set oConn1 = oEnv.brOpenConnection("ODBC", "USproduction") Set oConn2 = oEnv.brOpenConnection("ODBC", "UKproduction") ' Customizing settings oConn2.brCurrency = "L" oConn2.brDecimal = "," oConn2.brGrouping = "." ... ' Closing connections oEnv.brCloseConnection oConn1 oEnv.brCloseConnection oConn2 Set oEnv = Nothing End Sub