OdbcConnectionStringBuilder.Clear メソッド
アセンブリ: System.Data (system.data.dll 内)


Clear メソッドは、OdbcConnectionStringBuilder からすべてのキー/値ペアを削除し、Driver プロパティおよび Dsn プロパティを既定値にリセットします。また、Clear メソッドでは、Count プロパティが 0 に、ConnectionString プロパティが空の文字列に設定されます。

Imports System.Data.Odbc Module Module1 Sub Main() Dim builder As New OdbcConnectionStringBuilder() ' Call the Add method to explicitly add key/value ' pairs to the internal collection. builder.Driver = "Microsoft Excel Driver (*.xls)" builder("Dbq") = "C:\Data.xls" builder("DriverID") = "790" builder("DefaultDir") = "C:\" ' Dump the contents of the "filled-in" OdbcConnectionStringBuilder ' to the console window. DumpBuilderContents(builder) ' Clear current values and reset known keys to their ' default values. builder.Clear() ' Dump the contents of the newly emptied ' OdbcConnectionStringBuilder ' to the console window. DumpBuilderContents(builder) Console.WriteLine("Press Enter to continue.") Console.ReadLine() End Sub Private Sub DumpBuilderContents(ByVal builder As OdbcConnectionStringBuilder) Console.WriteLine("=================") 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() { OdbcConnectionStringBuilder builder = new OdbcConnectionStringBuilder(); // Call the Add method to explicitly add key/value // pairs to the internal collection. builder.Driver = "Microsoft Excel Driver (*.xls)"; builder["Dbq"] = "C:\\Data.xls"; builder["DriverID"] = "790"; builder["DefaultDir"] = "C:\\"; // Dump the contents of the "filled-in" OdbcConnectionStringBuilder // to the Console window: DumpBuilderContents(builder); // Clear current values and reset known keys to their // default values. builder.Clear(); // Dump the contents of the newly emptied OdbcConnectionStringBuilder // to the console window. DumpBuilderContents(builder); Console.WriteLine("Press Enter to continue."); Console.ReadLine(); } private static void DumpBuilderContents(OdbcConnectionStringBuilder builder) { Console.WriteLine("================="); Console.WriteLine("builder.ConnectionString = " + builder.ConnectionString); foreach (string key in builder.Keys) { Console.WriteLine(key + "=" + builder[key].ToString()); } } }

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からOdbcConnectionStringBuilder.Clear メソッドを検索する場合は、下記のリンクをクリックしてください。

- OdbcConnectionStringBuilder.Clear メソッドのページへのリンク