Share via


Visual Basic: RDO Data Control

Connect Property and OpenConnection Example: DSN-Less Connection Using OpenConnection

The following example establishes a DSN-less ODBC connection using the OpenConnection method against the default rdoEnvironment. In this case the example prints the resulting Connect property to the Immediate window.

  Dim en as rdoEnvironment
Dim cn as rdoConnection

Set en = rdoEnvironments(0)
Set cn = en.OpenConnection(dsName:="", _
    Prompt:=rdDriverNoPrompt, _
    Connect:="uid=;pwd=;driver={SQL Server};" _
        & "server=SEQUEL;database=pubs;")
debug.print cn.Connect