Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2004
    Posts
    1

    Unanswered: VB connect to Sybase Problem

    Hi all,

    Can anyone can help me connecting sybase under VB environment ?

    Here is my development environment :

    Database : Sybase 12.5
    Development Tool : VB 6.0
    Client ODBC Driver : Sybase ASE ODBC Driver

    When I connected the databse is ok but retrieving data that have the following problem :

    Error : -2147217887(80040021)
    ODBC driver does not support the requested properties.

    What can I do ?

  2. #2
    Join Date
    Mar 2004
    Location
    www.scirocco.ca
    Posts
    346

    Re: VB connect to Sybase Problem

    First off here are some ODBC connection strings using Sybase, following is some VB code to connect using one of these connection strings to your database:

    ================================
    CONNECTIOn STRINGS
    ================================
    If using the Sybase System 12 (or 12.5) Enterprise Open Client ODBC Driver

    oConn.Open "Driver={SYBASE ASE ODBC Driver};" & _
    "Srvr=myServerName;" & _
    "Uid=myUsername;" & _
    "Pwd=myPassword"

    If using the Sybase System 11 ODBC Driver

    oConn.Open "Driver={SYBASE SYSTEM 11};" & _
    "Srvr=myServerName;" & _
    "Uid=myUsername;" & _
    "Pwd=myPassword"

    If using the Intersolv 3.10 Sybase ODBC Driver

    oConn.Open "Driver={INTERSOLV 3.10 32-BIT Sybase};" & _
    "Srvr=myServerName;" & _
    "Uid=myUsername;" & _
    "Pwd=myPassword"
    ====================================
    VB CODE
    ====================================
    Dim cn as ADODB.Connection
    Dim rs as ADODB.Recordset

    Set cn = new ADODB.Connection

    cn.ConnectionString = "Driver={SYBASE ASE ODBC Driver};" & _
    "Srvr=myServerName;" & _
    "Uid=myUsername;" & _
    "Pwd=myPassword"

    cn.open

    set rs = new ADODB.recordset

    rs.ActiveConnection = cn

    rs.Open "SELECT * FROM Table1"

    rs.Close

    cn.Close

    Set rs=Nothing
    Set cn = Nothing
    http://www.scirocco.ca/images/banner...occobanner.gif

    Download for FREE the ADO/DAO Data Controls that makes life EASIER developing database applications in: VB, FoxPro, Access, VC++, .NET etc... Navigate, Add New, Delete, Update, Search, Undo and Save your changes. Supports Disconnected Recordsets and Transactions!

    Or try our Ask An Expert service to answer any of your questions!

Posting Permissions

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