Hi ,
I am facing some syntax error with below code
for connecting to sybase from excel
Please help me in resolving the issue.
Code:
Sub Get_Data()
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=ABCD2.app.xxxx.com,1234;" & _
"Catalog=ASEI2;" & _
"User Id=am111;" & _
"Password=mypwd12"
'this assumes Sybase Adaptive Server 12.5
'5000 is the port number
'change the DBName, UserName & Password to suit
sSQL = "SELECT top10 From object "
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
the output can be mailed to my mail id
lankaprasad01@gmail.com
It would be a great help to me.......
Regards
Venkat
Bookmarks