Results 1 to 2 of 2

Thread: DataSource Name at Runtime

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2000
    Posts
    5
    Is there an object that allows the user to select an available ODBC datasource at run time from available data sources on the PC? I imagine it would behave in the same manner as the drop down box in the MSRDC data source property window at design time. This feature (I don't know how) lists datasources available on the PC

    Thank you in advance.

  2. #2
    Guru Clunietp's Avatar
    Join Date
    Oct 1999
    Location
    USA
    Posts
    1,844
    Code:
        'uses ODBC DRIVER & DATA SOURCE NAME FUNCTIONS library
        'this will list all DSNs and ODBC drivers installed
        'on the current machine
        
        Dim objDSN As Dsn
        Dim lngCounter As Long
        
        Set objDSN = New Dsn
        
        Dim strDSNArray() As String
        Dim strDriverArray() As String
        
        '==============================================================
        'GET DSN LISTING
        '==============================================================
        objDSN.GetDataSourceList strDSNArray
        
        Debug.Print "-------------------DSNs--------------------------"
        For lngCounter = LBound(strDSNArray()) To UBound(strDSNArray())
            Debug.Print strDSNArray(lngCounter)
        Next lngCounter
        '==============================================================
        'GET ODBC DRIVER LISTING
        '==============================================================
        objDSN.GetOdbcDriverList strDriverArray()
        
        Debug.Print "---------------ODBC Drivers----------------------"
        For lngCounter = LBound(strDriverArray()) To UBound(strDriverArray())
            Debug.Print strDriverArray(lngCounter)
        Next lngCounter
        '==============================================================
        'cleanup
        Set objDSN = Nothing
    HTH

    Tom

Posting Permissions

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



Click Here to Expand Forum to Full Width