Difference between revisions of "ADO Tools"

From AutoIt Wiki
Jump to navigation Jump to search
(Created page with "= List all installed OLE DB providers = <syntaxhighlight lang="autoit"> Global $sOutput, $oRegistry, $oKey, $sKey = "HKCR\CLSID", $i = 1 While 1 $sSubKey = RegEnumKey($sKe...")
 
Line 1: Line 1:
 
= List all installed OLE DB providers =
 
= List all installed OLE DB providers =
 
<syntaxhighlight lang="autoit">
 
<syntaxhighlight lang="autoit">
Global $sOutput, $oRegistry, $oKey, $sKey = "HKCR\CLSID", $i = 1
+
#include <Array.au3>
 +
Global $sOutput, $oRegistry, $oKey, $sKey = "HKCR\CLSID", $iIndexReg = 1, $iIndexResult = 0
 +
Global $aResult[200][3]
 
While 1
 
While 1
     $sSubKey = RegEnumKey($sKey, $i)
+
     $sSubKey = RegEnumKey($sKey, $iIndexReg)
 
     If @error Then ExitLoop
 
     If @error Then ExitLoop
 
     $sKeyValue = RegRead($sKey & "\" & $sSubKey, "OLEDB_SERVICES")
 
     $sKeyValue = RegRead($sKey & "\" & $sSubKey, "OLEDB_SERVICES")
     If @error = 0 Then ConsoleWrite($sKey & "\" & $sSubKey & @TAB & RegRead($sKey & "\" & $sSubKey, "") & @TAB & RegRead($sKey & "\" & $sSubKey & "\OLE DB Provider", "") & @LF)
+
     If @error = 0 Then
     $i = $i + 1
+
        $aResult[$iIndexResult][0] = $sKey & "\" & $sSubKey
 +
        $aResult[$iIndexResult][1] = RegRead($sKey & "\" & $sSubKey, "")
 +
        $aResult[$iIndexResult][2] = RegRead($sKey & "\" & $sSubKey & "\OLE DB Provider", "")
 +
        $iIndexResult = $iIndexResult + 1
 +
    EndIf
 +
     $iIndexReg = $iIndexReg + 1
 
WEnd
 
WEnd
 +
ReDim $aResult[$iIndexResult][3]
 +
_ArrayDisplay($aResult, "OLE DB Providers", "", 0, Default, "Registry key|OLE DB Provider|Description")
 
</syntaxhighlight>
 
</syntaxhighlight>
  
 
Result:
 
Result:
[[File:ADO OLE DB Providers.jpg|thumbnail|OLE DB Providers]]
+
 
 +
[[File:ADO OLE DB Providers.jpg||OLE DB Providers]]

Revision as of 10:31, 9 January 2014

List all installed OLE DB providers

#include <Array.au3>
Global $sOutput, $oRegistry, $oKey, $sKey = "HKCR\CLSID", $iIndexReg = 1, $iIndexResult = 0
Global $aResult[200][3]
While 1
    $sSubKey = RegEnumKey($sKey, $iIndexReg)
    If @error Then ExitLoop
    $sKeyValue = RegRead($sKey & "\" & $sSubKey, "OLEDB_SERVICES")
    If @error = 0 Then
        $aResult[$iIndexResult][0] = $sKey & "\" & $sSubKey
        $aResult[$iIndexResult][1] = RegRead($sKey & "\" & $sSubKey, "")
        $aResult[$iIndexResult][2] = RegRead($sKey & "\" & $sSubKey & "\OLE DB Provider", "")
        $iIndexResult = $iIndexResult + 1
    EndIf
    $iIndexReg = $iIndexReg + 1
WEnd
ReDim $aResult[$iIndexResult][3]
_ArrayDisplay($aResult, "OLE DB Providers", "", 0, Default, "Registry key|OLE DB Provider|Description")

Result:

OLE DB Providers