Share via


OracleConnectionStringBuilder.DataSource 속성

정의

연결할 Oracle 데이터 소스의 이름을 가져오거나 설정합니다.

public:
 property System::String ^ DataSource { System::String ^ get(); void set(System::String ^ value); };
public string DataSource { get; set; }
member this.DataSource : string with get, set
Public Property DataSource As String

속성 값

DataSource 속성의 값이거나, 제공된 값이 없으면 Empty입니다.

예제

다음 예제에 나와 있는 OracleConnectionStringBuilder 클래스 "Data Source" 연결 문자열 키에 대 한 동의어를 잘 알려진 키로 변환 합니다.

// You may need to set a reference to the System.Data.OracleClient
// assembly before you can run this sample.
using System.Data.OracleClient;

class Program
{
    static void Main()
    {
        OracleConnectionStringBuilder builder =
            new OracleConnectionStringBuilder(
            "Server=OracleDemo;Integrated Security=True");

        // Display the connection string, which should now
        // contains the "Data Source" key, as opposed to the
        // supplied "Server".
        Console.WriteLine(builder.ConnectionString);

        // Retrieve the DataSource property.
        Console.WriteLine("DataSource = " + builder.DataSource);

        Console.WriteLine("Press any key to continue.");
        Console.ReadLine();
    }
}
' You may need to set a reference to the System.Data.OracleClient
' assembly before running this example.
Imports System.Data.OracleClient

Module Module1

  Sub Main()
    Dim builder As _
     New OracleConnectionStringBuilder( _
     "Server=OracleDemo;Integrated Security=True")

    ' Display the connection string, which should now 
    ' contains the "Data Source" key, as opposed to the 
    ' supplied "Server".
    Console.WriteLine(builder.ConnectionString)

    ' Retrieve the DataSource property.
    Console.WriteLine("DataSource = " & builder.DataSource)

    Console.WriteLine("Press any key to continue.")
    Console.ReadLine()
  End Sub

End Module

설명

이 속성은 연결 문자열 내의 "Data Source" 및 "Server" 키에 해당 합니다. 제공된 된 연결 문자열 내에서 어떤이 값을 제공 하는 것에 관계 없이 연결 문자열에서 만든는 OracleConnectionStringBuilder 잘 알려진 "Data Source" 키를 사용 합니다. 속성을 설정하려고 할 때 전달된 값이 null이면 DataSource 속성이 다시 설정됩니다. 반환 값은 값 설정 되지 않은 경우 개발자가 속성을 검색 하려고 Empty합니다.

적용 대상

추가 정보