Results 1 to 1 of 1

Connecting to Sysbase Database from Excel .........

Threaded View

  1. #1
    Registered User
    Join Date
    05-19-2014
    MS-Off Ver
    Excel 2003
    Posts
    1

    Connecting to Sysbase Database from Excel .........

    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
    Last edited by Venkata_lanka01; 05-20-2014 at 04:57 AM. Reason: email id added

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. connecting database curopting excel
    By Andre Kruger in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-04-2006, 08:40 AM
  2. Connecting To a Excel Database
    By NOODLES101487 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-14-2005, 10:05 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1