OdbcConnectionStringBuilder.Keys プロパティとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > OdbcConnectionStringBuilder.Keys プロパティの意味・解説 

OdbcConnectionStringBuilder.Keys プロパティ

メモ : このプロパティは、.NET Framework version 2.0新しく追加されたものです。

OdbcConnectionStringBuilder 内のキー格納している ICollection を取得します

名前空間: System.Data.Odbc
アセンブリ: System.Data (system.data.dll 内)
構文構文

Public Overrides ReadOnly
 Property Keys As ICollection
Dim instance As OdbcConnectionStringBuilder
Dim value As ICollection

value = instance.Keys
public override ICollection Keys { get; }
public:
virtual property ICollection^ Keys {
    ICollection^ get () override;
}
/** @property */
public ICollection get_Keys ()

プロパティ
OdbcConnectionStringBuilder 内のキー格納している ICollection

解説解説

ICollection格納される値の順序は、Values プロパティから返される ICollection 内の対応する値と同じ順序なります

使用例使用例

新しOdbcConnectionStringBuilder作成するコンソール アプリケーションの例を次に示します。このコードでは、Keys プロパティから返されICollectionループ処理しながらキー/値ペア表示します

メモメモ

この例には、OdbcConnectionStringBuilder接続文字列どのように連携するかを示すパスワード含まれています。アプリケーションでは、Windows 認証使用お勧めます。パスワード使用する必要がある場合は、ハードコーディングされたパスワードアプリケーション組み込まないください

Imports System.Data.Odbc    
Module Module1
  Sub Main()
    Try
      ' Build an empty instance, just to see
      ' the contents of the keys.
      DumpBuilderContents("")

      ' Create a SQL Server connection string.
      DumpBuilderContents("Driver={SQL Server};Server=(local);Database=AdventureWorks;Uid=ab;Pwd=pass@word1")

      ' Create an Access connection string.
      DumpBuilderContents("Driver={Microsoft Access Driver (*.mdb)};Dbq=C:\info.mdb;Exclusive=1;Uid=admin;Pwd=pass@word1")

      ' Create an Oracle connection string.
      DumpBuilderContents("Driver={Microsoft ODBC for Oracle};Server=OracleServer.world;Uid=Admin;Pwd=pass@word1;")

      ' Create a Sybase connection string.
      DumpBuilderContents("Driver={SYBASE ASE ODBC Driver};Srvr=SomeServer;Uid=admin;Pwd=pass@word1")

      Console.WriteLine("Press any key to finish.")
      Console.ReadLine()

    Catch ex As System.ArgumentException
      Console.WriteLine("Error: " & ex.Message)
    End Try
  End Sub

  Private Sub DumpBuilderContents(ByVal
 connectString As String)
    Dim builder As New OdbcConnectionStringBuilder(connectString)
    Console.WriteLine("=================")
    Console.WriteLine("Original connectString   = "
 & connectString)
    Console.WriteLine("builder.ConnectionString = "
 & builder.ConnectionString)
    For Each key As String
 In builder.Keys
      Console.WriteLine(key & "=" & builder.Item(key).ToString)
    Next
  End Sub
End Module
using System.Data.Odbc;

class Program
{
    static void Main()
    {
        try
        {
            // Build an empty instance, just to see
            // the contents of the keys.
            DumpBuilderContents("");

            // Create a SQL Server connection string.
            DumpBuilderContents("Driver={SQL Server};Server=(local);Database=AdventureWorks;Uid=ab;Pwd=pass@word1");

            // Create an Access connection string.
            DumpBuilderContents(@"Driver={Microsoft Access Driver (*.mdb)};Dbq=C:\info.mdb;Exclusive=1;Uid=admin;Pwd=pass@word1");

            // Create an Oracle connection string.
            DumpBuilderContents("Driver={Microsoft ODBC for
 Oracle};Server=OracleServer.world;Uid=Admin;Pwd=pass@word1;");

            // Create a Sybase connection string.
            DumpBuilderContents("Driver={SYBASE ASE ODBC Driver};Srvr=SomeServer;Uid=admin;Pwd=pass@word1");

            Console.WriteLine("Press any key to finish.");
            Console.ReadLine();

        }
        catch (System.ArgumentException ex)
        {
            Console.WriteLine("Error: " + ex.Message);
        }
    }

    private static void
 DumpBuilderContents(string connectString)
    {
        OdbcConnectionStringBuilder builder =
            new OdbcConnectionStringBuilder(connectString);
        Console.WriteLine("=================");
        Console.WriteLine("Original connectString   = " + connectString);
        Console.WriteLine("builder.ConnectionString = " + builder.ConnectionString);
        foreach (string key in
 builder.Keys)
        {
            Console.WriteLine(key + "=" + builder[key].ToString());
        }
    }
}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
OdbcConnectionStringBuilder クラス
OdbcConnectionStringBuilder メンバ
System.Data.Odbc 名前空間
その他の技術情報
Building Connection Strings
接続文字列使用


このページでは「.NET Framework クラス ライブラリ リファレンス」からOdbcConnectionStringBuilder.Keys プロパティを検索した結果を表示しています。
Weblioに収録されているすべての辞書からOdbcConnectionStringBuilder.Keys プロパティを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からOdbcConnectionStringBuilder.Keys プロパティ を検索

英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

OdbcConnectionStringBuilder.Keys プロパティのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



OdbcConnectionStringBuilder.Keys プロパティのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS