connecting to sybase with ado in vba

Hi,
I'm trying to figure out how to connect to sybase with ado. So far I haven't been able to find many good resources online, as most tutorials seem to be for Access databases. I'm using Sybase ASE 12.x, and vba for Excel 2000. I've got the ADO 2.7 library. I know my driver and OLE DB provider. I also know the db name, port, host. But I keep getting error when trying to create and access the recordset.  

Dim conn
Set conn = CreateObject("ADODB.Connection")

conn.Provider = "the sybase provider"
conn.Open "Driver={the driver};" & _
          "Database=dbName;" & _
           "Srvr=someServer;" & _
           "Uid=someID;" & _
           "Pwd=pass"

Set rs = CreateObject("ADODB.recordset")
rs.Open "select userID from table1, conn"

For Each x In rs.fields
   MsgBox x
Next

I dont think I set up the Open connection correctly, I'm not even sure what kind of string is supposed to go in there (what are all the connection properties that need to be set). Is there even an ADO reference library anywhere online??
Thanks in advance for any insights provided.
otiemotAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

cmurugavelCommented:
Hi,

Follow the below coding, it should work since it's working on my production system :


'database variables
Dim dbSAP As New ADODB.Connection
Dim rsSAP As New ADODB.Recordset
Dim sProc As String
Public wsSAP As Worksheet

'FOR CAD_SYSTEM
    sPass = "passwd"
    sUserId = "login"
    sDataSourceName = "database name"
   
----------------------------------------------------
   
Sub ConnectToDatabase()
    'set logon details:
    Debug.Print "Connecting to database"
     
    On Error GoTo Login_Error
    If dbSAP.State = 0 Then
        dbSAP.Open sDataSourceName, sUserId, sPass, 0
    End If

    Exit Sub
 
Login_Error:
     MsgBox "Could not connect to the database. Please contact the System Administrator."
     End
     'Application.Quit
     
End Sub

Cheers
C.M
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
leonstrykerCommented:
otiemot,

Do you still need help with this, or can it be closed?
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Sybase Database

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.