The following example illustrates creation of the rdoEnvironment object and its subsequent use to open an rdoConnection object.
Private Sub rdoEnvironmentButton_Click()
Dim en As rdoEnvironment
Dim cn As rdoConnection
Set en = rdoEngine.rdoEvironments(0)
With en
en.CursorDriver = rdUseOdbc
en.LoginTimeout = 5
en.Name = "TransOp1"
Set cn = en.OpenConnection(dsname:="", _
prompt:=rdDriverNoPrompt, _
Connect:="UID=;PWD=;" _
driver={SQL Server};Server=SEQUEL;", _
Options:=rdAsyncEnable)
End With
Print "Connecting ";
While cn.StillConnecting
Print ".";
DoEvents
Wend
Print "done."
End Sub