Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


New ADO connection to Sybase in vbscript

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,1014
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> New ADO connection to Sybase in vbscript
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 New ADO connection to Sybase in vbscript - 4/30/2004 2:36:08 AM   
  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
 
 
Post #: 1
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> New ADO connection to Sybase in vbscript Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts