DBProviderInfos.Item[Object] プロパティ
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
コレクションから DBProviderInfo オブジェクトを返します。
public:
property Microsoft::SqlServer::Dts::Runtime::DBProviderInfo ^ default[System::Object ^] { Microsoft::SqlServer::Dts::Runtime::DBProviderInfo ^ get(System::Object ^ index); };
public Microsoft.SqlServer.Dts.Runtime.DBProviderInfo this[object index] { get; }
member this.Item(obj) : Microsoft.SqlServer.Dts.Runtime.DBProviderInfo
Default Public ReadOnly Property Item(index As Object) As DBProviderInfo
パラメーター
- index
- Object
返すべき DBProviderInfo オブジェクトの名前、説明、またはインデックス。
プロパティ値
DBProviderInfos オブジェクト。
例
以下のコード例は、コレクションからアイテムを取得するために2つの方法を用います。 最初の方法は dbprovInfos[0] 構文を用いて、コレクションの最初の位置にあるオブジェクト全体を取得し、 dbInfo オブジェクトに配置します。 通常通り dbInfo オブジェクトからすべてのプロパティを取得することができます。 2つ目の方法は、コレクションの最初のオブジェクトから特定のプロパティを取得する方法を示しています。
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.SqlServer.Dts.Runtime;
namespace DBProvInfos_GetEnum
{
class Program
{
static void Main(string[] args)
{
Application app = new Application();
DBProviderInfos dbprovInfos = app.DBProviderInfos;
//Using the Item method syntax of [x], obtain the first entry.
DBProviderInfo dbInfo = dbprovInfos[0];
String nameOfFirstItem = dbprovInfos[0].Name;
//Print the name of the log provider object located at position [0].
Console.WriteLine("The db provider type of the first provider is: {0}", dbInfo.ProviderType);
Console.WriteLine("The Name of the first database provider is: {0}", nameOfFirstItem);
}
}
}
Imports System
Imports System.Collections.Generic
Imports System.Text
Imports Microsoft.SqlServer.Dts.Runtime
Namespace DBProvInfos_GetEnum
Class Program
Shared Sub Main(ByVal args() As String)
Dim app As Application = New Application()
Dim dbprovInfos As DBProviderInfos = app.DBProviderInfos
'Using the Item method syntax of [x], obtain the first entry.
Dim dbInfo As DBProviderInfo = dbprovInfos(0)
Dim nameOfFirstItem As String = dbprovInfos(0).Name
'Print the name of the log provider object located at position [0].
Console.WriteLine("The db provider type of the first provider is: {0}", dbInfo.ProviderType)
Console.WriteLine("The Name of the first database provider is: {0}", nameOfFirstItem)
End Sub
End Class
End Namespace
出力例:
最初のプロバイダーのdbプロバイダータイプはOleDbです。
最初のデータベースプロバイダーの名前は、MediaCatalogDB OLE DBプロバイダーです
注釈
メソッド Contains 呼び出しが true返された場合、構文 DBProviderInfos[index] を使ってコレクション内の指定された要素にアクセスできます。
Containsがfalseを返すと、このプロパティは例外を投げます。 C# では、このプロパティは DBProviderInfos クラスのインデクサーです。