|
-
Jul 27th, 2006, 07:04 AM
#1
Thread Starter
Addicted Member
[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!
-
Jul 27th, 2006, 07:10 AM
#2
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.
-
Jul 27th, 2006, 07:20 AM
#3
Thread Starter
Addicted Member
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!
-
Jul 27th, 2006, 07:44 AM
#4
Re: List of db providers
Try
VB Code:
Option Explicit
Private Declare Function SQLDataSources% Lib "ODBC32.DLL" (ByVal henv&, _
ByVal fdir%, ByVal szDSN$, ByVal cbDSNMax%, pcbDSN%, ByVal szDesc$, _
ByVal cbDescMax%, pcbDesc%)
Private Declare Function SQLAllocEnv% Lib "ODBC32.DLL" (env&)
Private Const SQL_SUCCESS As Long = 0
Private Const SQL_FETCH_NEXT As Long = 1
Private Sub Form_Load()
Dim lngGetDBProviders As Long
Dim sDSNItem As String * 1024
Dim sDRVItem As String * 1024
Dim sDSN As String
Dim iDSNLen As Integer
Dim iDRVLen As Integer
Dim lHenv As Long 'handle to the environment
If SQLAllocEnv(lHenv) <> -1 Then
Do Until lngGetDBProviders <> SQL_SUCCESS
sDSNItem = Space(1024)
sDRVItem = Space(1024)
lngGetDBProviders = SQLDataSources(lHenv, SQL_FETCH_NEXT, sDSNItem, 1024, iDSNLen, sDRVItem, 1024, iDRVLen)
sDSN = Left(sDSNItem, iDSNLen)
If sDSN <> Space(iDSNLen) Then
Combo1.AddItem sDSN
End If
Loop
Combo1.ListIndex = 0
End If
End Sub
-
Jul 28th, 2006, 02:15 AM
#5
Thread Starter
Addicted Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|