| |
amackley
Posts: 3
Score: 0
Joined: 4/30/2004
From: USA
Status: offline
|
I've been working with vbscript for some time. However, I've been recently trying to connnect via ADO to a Sybase database. I can't seem to figure it out. I'm not certain what I need in each of the connection string. I have set up an ODBC connection. In ODBC Data Source Administrator, The User Data Source is called Locations54. The Driver is "Sybase System 11". The Server Name is called "LOCATIONS5" and the Database Name is "locations5" Here is my current code: Private AdConnection As ADODB.Connection Private rsAdSet As ADODB.RecordSet Private addbname as String, adusername as String, addbserver As String, adDBPassword as String Const DBProvider = "LOCATIONS54" addbname = "locations5" adusername = "myusername" addbserver = "LOCATIONS5" adDBPassword = "MYPASSWORD" Private Sub Login() Dim strSQL as String Rem -- The Next Line sets up the SQL to whatever you want strSQL = "Select adid, adname from ad where adname like '%test%'" Set AdConnection = New ADODB.Connection Set rsAdSet as ADODB.Recordset AdConnString = ";Provider=" & DBProvider & ";Password=" & adDBPassword & _ ";Persist Security Info=True;User ID=" & adusername & _ ";Data Source=" & addbserver & _ ";Initial Catalog=" & addbname AdConnection.ConnectionString = AdConnString With AdConnection If .state <> 0 Then .close .Open End With rsAdSet.Open strSQL, AdConnection, adOpenStatic End Sub Aaron Mackley
|
|