Howdy, Stranger!

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

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Converting an RDO to ADO

inbinb Posts: 15Member
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.

Comments

  • PrzemekG_PrzemekG_ Posts: 595Member
    : 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.
    :
    That is true :)

    [code]
    Dim MyConnection as ADODB.Connection
    set MyConnection = new ADODB.Connection
    MyConnection.Open("your connection string goes here...")
    [/code]
Sign In or Register to comment.