Example
The following simple code snippet iterates over the returned list that the OleDbEnumerator
returns and prints them.
using System;
using System.Data;
using System.Data.OleDb;
class C {
static void Main() {
OleDbEnumerator E = new OleDbEnumerator();
DataTable table = E.GetElements();
foreach (DataRow row in table.Rows) {
Console.WriteLine("{0,-30} {1,-60} {2} {3,-5} {4}",
row["SOURCES_NAME" ],
// row["SOURCES_PARSENAME" ], // == CLSID ???
row["SOURCES_DESCRIPTION"],
row["SOURCES_TYPE" ],
row["SOURCES_ISPARENT" ],
row["SOURCES_CLSID" ]
);
// foreach (DataColumn col in table.Columns) {
// Console.WriteLine("{0} = {1}", col.ColumnName, row[col]);
// }
}
}
}
When executed, the program might print something like
IBMDADB2 Advanced Page. IBM OLE DB Provider - 1 False {00000000-0000-0000-0000-000000000000}
IBMDADB2 Advanced Page. IBM DB OLE DB Enumerator 2 False {00000000-0000-0000-0000-000000000000}
SQLOLEDB Microsoft OLE DB Provider for SQL Server 1 False {0C7FF16C-38E3-11d0-97AB-00C04FC2AD98}
MSDataShape MSDataShape 1 False {3449A1C8-C56C-11D0-AD72-00C04FC29863}
SQLNCLI11 SQL Server Native Client 11.0 1 False {397C2819-8272-4532-AD3A-FB5E43BEAA39}
Microsoft.Jet.OLEDB.4.0 Microsoft Jet 4.0 OLE DB Provider 1 False {dee35070-506b-11cf-b1aa-00aa00b8de95}
Microsoft.ACE.OLEDB.12.0 Microsoft Office 12.0 Access Database Engine OLE DB Provider 1 False {3BE786A0-0366-4F5C-9434-25CF162E475E}
Microsoft.ACE.OLEDB.15.0 Microsoft Office 15.0 Access Database Engine OLE DB Provider 1 False {3BE786A1-0366-4F5C-9434-25CF162E475E}
Microsoft.ACE.OLEDB.16.0 Microsoft Office 16.0 Access Database Engine OLE DB Provider 1 False {3BE786A2-0366-4F5C-9434-25CF162E475E}
OraOLEDB.Oracle Oracle Provider for OLE DB 1 False {3F63C36E-51A3-11D2-BB7D-00C04FA30080}
ADsDSOObject OLE DB Provider for Microsoft Directory Services 1 False {549365d0-ec26-11cf-8310-00aa00b505db}
SSISOLEDB OLE DB Provider for SQL Server Integration Services 1 False {688037C5-0B57-464B-A953-90A806CC34C2}
SQLNCLIRDA11 SQL Server Native Client RDA 11.0 1 False {726D00DE-837A-45EB-AE8C-EDD241F9079C}
SQLNCLI11 Enumerator SQL Server Native Client 11.0 Enumerator 2 False {8F612DD2-7E28-424f-A2FD-C2EECC314AA2}
Windows Search Data Source Microsoft OLE DB Provider for Search 1 False {9E175B8B-F52A-11D8-B9A5-505054503030}
SQLNCLIRDA11 Enumerator SQL Server Native Client RDA 11.0 Enumerator 2 False {A740F26C-DBE0-4096-839B-9D56E951546B}
MSDASQL Microsoft OLE DB Provider for ODBC Drivers 1 False {c8b522cb-5cf3-11ce-ade5-00aa0044773d}
MSDASQL Enumerator Microsoft OLE DB Enumerator for ODBC Drivers 2 False {c8b522cd-5cf3-11ce-ade5-00aa0044773d}
MSOLAP Microsoft OLE DB Provider for Analysis Services 14.0 1 False {DBC724B0-DD86-4772-BB5A-FCC6CAB2FC1A}
MSOLAP Microsoft OLE DB Provider for Analysis Services 14.0 3 False {DBC724B0-DD86-4772-BB5A-FCC6CAB2FC1A}
SQLOLEDB Enumerator Microsoft OLE DB Enumerator for SQL Server 2 False {DFA22B8E-E68D-11d0-97E4-00C04FC2AD98}
MSDAOSP Microsoft OLE DB Simple Provider 1 False {dfc8bdc0-e378-11d0-9b30-0080c7e9fe95}
MSDAORA Microsoft OLE DB Provider for Oracle 1 False {e8cc4cbe-fdff-11d0-b865-00a0c9081c1d}
Update 2021-08-19
foreach ($x in [System.Data.OleDb.OleDbEnumerator]::GetRootEnumerator()) {
'{0,-30} {1,-60} {2} {3} {4}' -f $x.Item(0), $x.Item(2), $x.Item(3), $x.Item(4), $x.item(1)
}