OracleConnectionStringBuilder.DataSource Properti

Definisi

Mendapatkan atau mengatur nama sumber data Oracle untuk disambungkan.

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

Nilai Properti

Nilai DataSource properti , atau Empty jika tidak ada yang disediakan.

Contoh

Contoh berikut menunjukkan bahwa OracleConnectionStringBuilder kelas mengonversi sinonim untuk kunci string koneksi "Sumber Data" menjadi kunci terkenal.

// 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

Keterangan

Properti ini sesuai dengan kunci "Sumber Data" dan "Server" dalam string koneksi. Terlepas dari nilai mana yang telah disediakan dalam string koneksi yang disediakan, string koneksi yang dibuat oleh OracleConnectionStringBuilder akan menggunakan kunci "Sumber Data" terkenal. Jika nilai yang diteruskan null saat Anda mencoba mengatur properti , DataSource properti akan direset. Jika nilai belum ditetapkan dan pengembang mencoba mengambil properti , nilai yang dikembalikan adalah Empty.

Berlaku untuk

Lihat juga