ExternalDatabaseConnections.AddEx

This function adds a new ExternalDataBase connection (with audit log explanation).

Syntax Parameters Return Value
Function ExternalDatabaseConnections.AddEx( _
    CreateInfo As ExternalDatabaseConnectionCreateInfo) As ExternalDatabaseConnection
CreateInfo [in]

Information about the new data source.

Type: ExternalDatabaseConnectionCreateInfo

ExternalDatabaseConnection

SVB Example

Setting Enterprise's DB as data source for DE Setups:

Sub Main

    'In this example, we will create a new data source that is pointing to our
    'Enterprise database, and then set that to be the default connection for
    'data entry setups.
    Dim oOM As ObjectManager
    'Reconnect into Enterprise ObjectManager
    Set oOM = New ObjectManager
    oOM.Reconnect Application

    Dim createDBSourceInfo As New ExternalDatabaseConnectionCreateInfo
    Dim dbSource As ExternalDatabaseConnection

    'Create a data connection to Enterprise's DB
    createDBSourceInfo.Name = "Enterprise"
    createDBSourceInfo.AuditLogReason = "Adding Enterprise's database as a data source"
    'Enter the connection string to your Enterprise's database here.
    'This will need to be customized for your specific system.
    createDBSourceInfo.ConnectionString = _
        "Provider=SQLOLEDB.1;Password=swordfish;Persist Security Info=True;User ID=sa;Initial Catalog=STATISTICADB;Data Source=DAYTONBAKE\SQLEXPRESSENT"
    'Add the data connection to the system
    Set dbSource = oOM.ExternalDatabaseConnections.AddEx(createDBSourceInfo)

    oOM.SystemOptions.DataEntryOptions.DefaultDatabaseForStandardProfile = dbSource
    Dim updateInfo As New SystemOptionUpdateInfo
    updateInfo.AuditLogReason = "Adding Enterprise's DB as the default DE Setup data source"
    oOM.SystemOptions.DataEntryOptions.SaveEx(updateInfo)

    oOM.Disconnect

End Sub