dbTalk Databases Forums  

how to programmatically get list of SQL server drivers installed

comp.databases.ms-access comp.databases.ms-access


Discuss how to programmatically get list of SQL server drivers installed in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
KW
 
Posts: n/a

Default how to programmatically get list of SQL server drivers installed - 10-29-2010 , 09:02 AM






I would like to programmatically get a list of the SQL server drivers
installed. This is needed for re-linking tables. If there is only
one, I would use that in the connect string, but if more than one, I
want to offer a list of SQL drivers available to choose from.

Any ideas?

Thanks.
KW

Reply With Quote
  #2  
Old   
The Frog
 
Posts: n/a

Default Re: how to programmatically get list of SQL server drivers installed - 10-30-2010 , 03:06 AM






Are you asking for the drivers installed on a client machine, or the
servers installed on a client machine, or servers on a network, or
ODBC connections available on a client machine ?

The Frog

Reply With Quote
  #3  
Old   
KW
 
Posts: n/a

Default Re: how to programmatically get list of SQL server drivers installed - 10-30-2010 , 08:19 AM



On Oct 30, 4:06*am, The Frog <mr.frog.to.... (AT) googlemail (DOT) com> wrote:
Quote:
Are you asking for the drivers installed on a client machine, or the
servers installed on a client machine, or servers on a network, or
ODBC connections available on a client machine ?

The Frog

I asking about the ODBC SQL drivers installed on the local machine;
the machine on which the app is running.

Thx

Reply With Quote
  #4  
Old   
KW
 
Posts: n/a

Default Re: how to programmatically get list of SQL server drivers installed - 10-30-2010 , 08:29 AM



This came from datAdrenaline on UtterAccess....just what I was looking
for:
------------------------------------------------------------------------------------------------
You can possibly use a variant of the following code to do what you
wish:

Public Sub PrintListOfODBCDriversToImmediateWindow()

Const HKEY_LOCAL_MACHINE = &H80000002

Dim strComputer As String
Dim objRegistry As Object
Dim strKeyPath As String
Dim arrValueNames As Variant
Dim arrValueTypes As Variant
Dim strValueName As String
Dim strValueType As String
Dim strValue As String
Dim i As Long

strComputer = "."

Set objRegistry = GetObject("winmgmts:\\" & strComputer & "\root
\default:StdRegProv")

strKeyPath = "SOFTWARE\ODBC\ODBCINST.INI\ODBC Drivers"
objRegistry.EnumValues HKEY_LOCAL_MACHINE, strKeyPath,
arrValueNames, arrValueTypes

For i = 0 To UBound(arrValueNames)
strValueName = arrValueNames(i)
objRegistry.GetStringValue HKEY_LOCAL_MACHINE, strKeyPath,
strValueName, strValue
Debug.Print arrValueNames(i) & " -- " & strValue
Next

End Sub

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.