Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

connecting to Sybase SQL Anywhere from VB

Status
Not open for further replies.

sdh

Programmer
Apr 30, 2001
121
0
0
GB
Has any body within this forium had any experience of connecting to sybase sql anywhere. My boss has just challenged me to connect to a sybase database used on our machines by a commercial software package we are using. |Bit of a new one to me I have no odbc drivers or anything. Can somebody point me in the right direction for drivers etc and help with an ado connection string?
It would be much appreciated.
Many thanks
sdh ::)
 
if you are using "Adaptive Server Anywhere 8" with vb6 then you can use the following piece of code.

Code:
Private Sub GetConnection()
    
    Dim cnGolf As ADODB.Connection
    Dim rsRec As ADODB.Recordset

    Set cnGolf = New ADODB.Connection
    cnGolf.Provider = "ASAProv"
    cnGolf.ConnectionString = _
      "Data Source=CartManager"
    cnGolf.Open
    
End Sub
[Code]

Comments:

ASAProv - the provider which is installed with "Adaptive Server Anywhere 8"
CartManager - name of the ODBC driver

PS. May work with other versions of VB and Sybase
 
I just found a way to connect to a sybase database without using the ODBC. I don't entirely understand why this works but you could try the following piece of code to connect.
You will still need a provider for this connection.

Private Sub GetConnection()
Dim cnGolf As ADODB.Connection
Set cnGolf = New ADODB.Connection
cnGolf.Provider = "ASAProv"
cnGolf.ConnectionString = "uid=dba;pwd=sql;dbf" & _ App.Path & "\CartManager.db"
cnGolf.Open
End Sub


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top