Using ADO instead of old RDO code.

Hi!! I was wondering if someone could help me with this. I want to convert the following code to use ADO instead of RDO..

Public Sub Open_SQLServer(strDatabase)

Set en = rdoEnvironments(0)

With rdoEngine
.rdoDefaultLoginTimeout = 20
.rdoDefaultCursorDriver = rdUseOdbc
.rdoDefaultUser = "xxxx"
.rdoDefaultPassword = ""
End With

Set en = rdoEnvironments(0)
Set cn = en.OpenConnection(dsName:="", _
Prompt:=rdDriverNoPrompt, _
Connect:="uid=xxx;pwd=xxxxxx;driver={SQL Server};" _
& "server=Jackdb;database=" & strDatabase & ";")
Debug.Print cn.Connect

End Sub

I would just use the new server info, however, it would be alot less code to write if I can just use ADO.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!