OleDbEnumerator.GetElements Método
Definição
public:
System::Data::DataTable ^ GetElements();
public System.Data.DataTable GetElements ();
member this.GetElements : unit -> System.Data.DataTable
Public Function GetElements () As DataTable
Retornos
Uma DataTable que contém informações sobre os provedores OLE DB visíveis.A DataTable that contains information about the visible OLE DB providers.
Exceções
O provedor não dá suporte a ISourcesRowset.The provider does not support ISourcesRowset.
Ocorreu uma exceção no provedor subjacente.Exception has occurred in the underlying provider.
Exemplos
O aplicativo de console a seguir recupera informações sobre todos os provedores de OLE DB visíveis e exibe as informações na janela do console.The following console application retrieves information about all the visible OLE DB providers and displays the information in the console window.
Imports System.Data
Imports System.Data.OleDb
Module Module1
Sub Main()
Dim enumerator As New OleDbEnumerator
Dim table As System.Data.DataTable = enumerator.GetElements()
DisplayData(table)
Console.WriteLine("Press any key to continue.")
Console.ReadKey()
End Sub
Private Sub DisplayData(ByVal table As DataTable)
For Each row As DataRow In table.Rows
For Each col As DataColumn In table.Columns
Console.WriteLine("{0} = {1}", col.ColumnName, row(col))
Next
Console.WriteLine("==================================")
Next
End Sub
End Module
using System;
using System.Data;
using System.Data.OleDb;
class Program
{
static void Main()
{
OleDbEnumerator enumerator = new OleDbEnumerator();
DataTable table = enumerator.GetElements();
DisplayData(table);
Console.WriteLine("Press any key to continue.");
Console.ReadKey();
}
static void DisplayData(DataTable table)
{
foreach (DataRow row in table.Rows)
{
foreach (DataColumn col in table.Columns)
{
Console.WriteLine("{0} = {1}", col.ColumnName, row[col]);
}
Console.WriteLine("==================================");
}
}
}
Comentários
A tabela retornada por esse método contém as seguintes colunas, todas as quais contêm cadeias de caracteres:The table that is returned by this method contains the following columns, all of which contain strings:
| Ordinal de colunaColumn Ordinal | ColumnColumn | DescriçãoDescription |
|---|---|---|
| 00 | SOURCES_NAMESOURCES_NAME | O nome invariável da fonte de dados OLEDB ou do enumerador nativo.The invariant name of the native OLEDB data source or enumerator. |
| 11 | SOURCES_PARSENAMESOURCES_PARSENAME | Um nome legível que pode ser convertido em um moniker usando a interface COM nativa IParseDisplayName.A human-readable name that can be converted to a moniker by using the native COM interface IParseDisplayName. Corresponde à coluna de SOURCES_PARSENAME retornada pelo conjunto de linhas de fontes de OLE DB nativas.Corresponds to the SOURCES_PARSENAME column returned by the native OLE DB sources rowset. |
| 22 | SOURCES_DESCRIPTIONSOURCES_DESCRIPTION | Descrição da fonte de dados do OLE DB nativo.Description of the native OLE DB data source. Corresponde à coluna de SOURCES_DESCRIPTION retornada pelo conjunto de linhas de fontes de OLE DB nativas.Corresponds to the SOURCES_DESCRIPTION column returned by the native OLE DB sources rowset. |
| 33 | SOURCES_TYPESOURCES_TYPE | Um dos seguintes membros de enumeração: Binder (0), DataSource_MDP (1), DataSource_TDP (2), enumerador (3).One of the following enumeration members: Binder (0), DataSource_MDP (1), DataSource_TDP (2), Enumerator (3). Elas correspondem aos valores retornados na coluna SOURCES_TYPE do conjunto de linhas nativo de fontes de OLE DB.These correspond to the values returned in the SOURCES_TYPE column of the native OLE DB sources rowset. |
| 44 | SOURCES_ISPARENTSOURCES_ISPARENT | Aplicável somente a enumeradores.Applicable to enumerators only. Se true , indica que a entrada se aplica ao mesmo enumerador no qual GetSourcesRowset foi chamado, implicando que ele também está incluído na subenumeração.If true, indicates that the entry applies to the same enumerator on which GetSourcesRowset was called, implying that it is also included in the sub-enumeration. Corresponde à coluna SOURCES_ISPARENT do conjunto de linhas nativo de fontes de OLE DBCorresponds to the SOURCES_ISPARENT column of the native OLE DB sources rowset |
| 55 | SOURCES_CLSIDSOURCES_CLSID | Um nome legível, que pode ser convertido em um moniker usando a interface COM nativa IParseDisplayName.A human-readable name, that can be converted to a moniker using the native COM interface IParseDisplayName. Corresponde à coluna de SOURCES_CLSID retornada pelo conjunto de linhas de fontes de OLE DB nativas.Corresponds to the SOURCES_CLSID column returned by the native OLE DB sources rowset. |