Results 1 to 5 of 5

Thread: [RESOLVED] List of db providers

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jul 2002
    Location
    10000 light years away
    Posts
    143

    Resolved [RESOLVED] List of db providers

    Hi All,

    How do I view the list of all db providers available on my machine using VB code?

    Thanks in advance!


    Binish
    I was gratified to be able to answer promptly. I said I don't know!

  2. #2
    VB Guru ganeshmoorthy's Avatar
    Join Date
    Dec 2005
    Location
    Sharjah, United Arab Emirates
    Posts
    3,031

    Re: List of db providers

    i hope from the registry you can read the details...
    If an answer to your question has been helpful, then please, Rate it!

    Have done Projects in Access and Member management systems using BioMetric devices, Smart cards and BarCodes.


  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jul 2002
    Location
    10000 light years away
    Posts
    143

    Re: List of db providers

    But could you suggest some VB code to do this?
    I was gratified to be able to answer promptly. I said I don't know!

  4. #4
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: List of db providers

    Try
    VB Code:
    1. Option Explicit
    2.  
    3. Private Declare Function SQLDataSources% Lib "ODBC32.DLL" (ByVal henv&, _
    4. ByVal fdir%, ByVal szDSN$, ByVal cbDSNMax%, pcbDSN%, ByVal szDesc$, _
    5. ByVal cbDescMax%, pcbDesc%)
    6.  
    7. Private Declare Function SQLAllocEnv% Lib "ODBC32.DLL" (env&)
    8.  
    9. Private Const SQL_SUCCESS As Long = 0
    10. Private Const SQL_FETCH_NEXT As Long = 1
    11.  
    12. Private Sub Form_Load()
    13. Dim lngGetDBProviders As Long
    14. Dim sDSNItem As String * 1024
    15. Dim sDRVItem As String * 1024
    16. Dim sDSN As String
    17. Dim iDSNLen As Integer
    18. Dim iDRVLen As Integer
    19. Dim lHenv As Long     'handle to the environment
    20.  
    21.    If SQLAllocEnv(lHenv) <> -1 Then
    22.       Do Until lngGetDBProviders <> SQL_SUCCESS
    23.          sDSNItem = Space(1024)
    24.          sDRVItem = Space(1024)
    25.          lngGetDBProviders = SQLDataSources(lHenv, SQL_FETCH_NEXT, sDSNItem, 1024, iDSNLen, sDRVItem, 1024, iDRVLen)
    26.          
    27.          sDSN = Left(sDSNItem, iDSNLen)
    28.          If sDSN <> Space(iDSNLen) Then
    29.             Combo1.AddItem sDSN
    30.          End If
    31.       Loop
    32.       Combo1.ListIndex = 0
    33.    End If
    34. End Sub

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Jul 2002
    Location
    10000 light years away
    Posts
    143

    Re: List of db providers

    That works. Thanks a lot!
    I was gratified to be able to answer promptly. I said I don't know!

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