The following example establishes a DSN-less ODBC connection by creating a stand-alone rdoConnection object and uses the EstablishConnection method to open the connection. Note that the DSN='';
argument is positioned at the end of the connect string. The example prints the resulting Connect property to the Immediate window.
' Create a DSN-less connection
' using a stand-alone rdoConnection object and
' the EstablishConnection method
'
Dim cn As New rdoConnection
Dim qd As New rdoQuery
cn.Connect = "uid=;pwd=;server=SEQUEL;" _
& "driver={SQL Server};database=pubs;" _
& "DSN='';"
cn.cursordriver = rdUseOdbc
cn.EstablishConnection rdDriverNoprompt
debug.print cn.Connect
Set qd.ActiveConnection = cn