Link to home
Start Free TrialLog in
Avatar of abidr
abidr

asked on

connect

how can I connect to a sybase database file from my VB6 project. I looked in the types of databased i can connect to, this was not listed. it has an extension of .DB. I need to generate reports from that file.

thanks
ASKER CERTIFIED SOLUTION
Avatar of himachal
himachal

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of abidr
abidr

ASKER

thanks,

I have the drivers with the application  but how can I make VB6 recognise it. Is there a way to register it or add it to any sys file... I have not done this before so if u can advise please.

ab
Hi,
If you have downloaded the driver and run the setup then in Control Panel's ODBC must show this driver.You have to make a dsn by giving appropiate information and then using this DSN you can connect to the sybase databse.

Himachal
The driver should be supplied with sybase package and should show up on the Drivers tab of the ODBC32 utility in the Windows control panel. The code should look something like this:



 Dim cn As New adodb.Connection

 Cnct = "uid=" & userID & ";pwd=" & Password & ";driver={Adaptive Server Anywhere 7.0};server=YourServer;database=YourDB; dsn=YourDNS(Not always required)"
    With cn
        .ConnectionString = Cnct
        .ConnectionTimeout = 10
        .CursorLocation = adUseServer
        .Open
    End With