Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello, all,
Can you provide an example to illustrate how to connect sybase DB with excel vba. I'll appreicate any reply for this thread. Thanks. Devon. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sub GetData()
Const adOpenForwardOnly As Long = 0 Const adLockReadOnly As Long = 1 Const adCmdText As Long = 1 Dim oRS As Object Dim sConnect As String Dim sSQL As String Dim ary sConnect = "Provider=Sybase.ASEOLEDBProvider;" & _ "Srvr=myASEServer,5000;" & _ "Catalog=myDBName;" & _ "User Id=myUser;" & _ "Password=myPassword" 'this assumes Sybase Adaptive Server 12.5 '5000 is the port number 'change the DBName, UserName & Password to suit sSQL = "SELECT * From Contacts" Set oRS = CreateObject("ADODB.Recordset") oRS.Open sSQL, sConnect, adOpenForwardOnly, _ adLockReadOnly, adCmdText ' Check to make sure we received data. If Not oRS.EOF Then ary = oRS.getrows MsgBox ary(0, 0) & " " & ary(1, 0) & ", " & ary(2, 0) Else MsgBox "No records returned.", vbCritical End If oRS.Close Set oRS = Nothing End Sub -- HTH Bob Phillips (remove nothere from email address if mailing direct) "Devon" wrote in message oups.com... Hello, all, Can you provide an example to illustrate how to connect sybase DB with excel vba. I'll appreicate any reply for this thread. Thanks. Devon. |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello, Bob,
Thank you for your great help, it works. I have searched this solution for long time before. |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
If the following string also be OK?:
ConnString="Driver={Sybase System};Srvr=ServerName;Db=abc;Uid=UserID;Pwd=User Pwd" |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Not with ADO I don't think.
-- HTH Bob Phillips (remove nothere from email address if mailing direct) "Devon" wrote in message oups.com... If the following string also be OK?: ConnString="Driver={Sybase System};Srvr=ServerName;Db=abc;Uid=UserID;Pwd=User Pwd" |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Excel cannot connect to web | Excel Discussion (Misc queries) | |||
Data Conversion into Sybase | Excel Discussion (Misc queries) | |||
Excel Query Via Sybase | Excel Discussion (Misc queries) | |||
Export data from Sybase into Excel 2003 | Excel Programming | |||
ODBC error linking to Sybase database | Excel Programming |