OracleConnectionStringBuilder.Item[String] 속성

정의

지정된 키에 연결된 값을 가져오거나 설정합니다. C#에서는 이 속성이 인덱서입니다.

public:
 virtual property System::Object ^ default[System::String ^] { System::Object ^ get(System::String ^ keyword); void set(System::String ^ keyword, System::Object ^ value); };
public override object this[string keyword] { get; set; }
member this.Item(string) : obj with get, set
Default Public Overrides Property Item(keyword As String) As Object

매개 변수

keyword
String

가져오거나 설정할 항목의 키입니다.

속성 값

지정한 키와 연결된 값입니다.

예외

keyword이 null 참조(Visual Basic의 경우 Nothing)인 경우

사용할 수 있는 키에 없는 키를 추가하려고 한 경우

연결 문자열에 잘못된 값이 포함된 경우(예: 부울 값이나 숫자 값이 필요하지만 제공되지 않은 경우)

예제

다음 콘솔 애플리케이션 코드에서는 새 OracleConnectionStringBuilder를 만들고 Item[] 속성을 사용하여 키/값 쌍을 연결 문자열에 추가합니다.

// 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();
        builder["Data Source"] = "localhost";
        builder["integrated security"] = true;
        builder["Unicode"] = true;

        // Overwrite the existing value for the Data Source value.
        builder["Data Source"] = "NewOracleDemo";

        Console.WriteLine(builder.ConnectionString);
        Console.WriteLine();
        Console.WriteLine("Press Enter to continue.");
        Console.ReadLine();
    }
}
' You may need to set a reference to the System.Data.OracleClient
' assembly before you can run this sample.
Imports System.Data.OracleClient

Module Module1
  Sub Main()
    Dim builder As New OracleConnectionStringBuilder
    builder.Item("Data Source") = "OracleDemo"
    ' Item is the default property, so 
    ' you need not include it in the reference.
    builder("integrated security") = True
    builder.Item("Unicode") = True

    ' Overwrite the existing value for the Data Source value.
    builder.Item("Data Source") = "NewOracleDemo"

    Console.WriteLine(builder.ConnectionString)
    Console.WriteLine()
    Console.WriteLine("Press Enter to continue.")
    Console.ReadLine()
  End Sub
End Module

설명

OracleConnectionStringBuilder에는 고정 크기의 사전이 포함되어 있기 때문에 사전에 없는 키를 추가하려고 하면 KeyNotFoundException이 throw됩니다. 다음 표에서 각각에 대 한 연결 문자열 및 기본 값 내에서 가능한 모든 키를 나열합니다.

속성 기본값
데이터 원본 (또는 서버) DataSource 빈 문자열
보안 정보 (또는 persistsecurityinfo)를 유지 합니다. PersistSecurityInfo 거짓
Integrated Security IntegratedSecurity 거짓
사용자 ID (또는 사용자 또는 uid) UserID 빈 문자열
암호 Password 빈 문자열
Enlist Enlist
Pooling Pooling
Min Pool Size MinPoolSize 0
Max Pool Size MaxPoolSize 100
Oracle 연결 이름을 생략합니다 OmitOracleConnectionName 거짓
유니코드(Unicode) Unicode 거짓
부하 분산 제한 시간 (또는 연결 수명) LoadBalanceTimeout 0

적용 대상

추가 정보