OleDbConnection.DataSource プロパティ
アセンブリ: System.Data (system.data.dll 内)


OleDbConnection を作成し、その読み取り専用プロパティの一部を表示する例を次に示します。
Public Sub OpenConnection(ByVal connectionString As String) Using connection As New OleDbConnection(connectionString) Try connection.Open() Console.WriteLine("Server Version: {0} DataSource: {1}", _ connection.ServerVersion, connection.DataSource) Catch ex As Exception Console.WriteLine(ex.Message) End Try ' The connection is automatically closed when the ' code exits the Using block. End Using End Sub
static void OpenConnection(string connectionString) { using (OleDbConnection connection = new OleDbConnection(connectionString)) { try { connection.Open(); Console.WriteLine("ServerVersion: {0} \nDataSource: {1}", connection.ServerVersion, connection.DataSource); } catch (Exception ex) { Console.WriteLine(ex.Message); } // The connection is automatically closed when the // code exits the using block. }
using System; using System.Data; using System.Data.OleDb; class Class1 { static void Main() { string x = "Provider=SQLOLEDB;Data Source=(local);Initial Catalog=AdventureWorks;" + "Integrated Security=SSPI"; OpenConnection(x); Console.ReadLine(); } static void OpenConnection(string connectionString) { using (OleDbConnection connection = new OleDbConnection(connectionString)) { try { connection.Open(); Console.WriteLine("ServerVersion: {0} \nDataSource: {1}" , connection.ServerVersion, connection.DataSource); } catch (Exception ex) { Console.WriteLine(ex.Message); } // The connection is automatically closed when the // code exits the using block. }

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に収録されているすべての辞書からOleDbConnection.DataSource プロパティを検索する場合は、下記のリンクをクリックしてください。

- OleDbConnection.DataSource プロパティのページへのリンク