DbConnectionStringBuilder.Values Property

Definition

Gets an ICollection that contains the values in the DbConnectionStringBuilder.

public:
 virtual property System::Collections::ICollection ^ Values { System::Collections::ICollection ^ get(); };
public virtual System.Collections.ICollection Values { get; }
[System.ComponentModel.Browsable(false)]
public virtual System.Collections.ICollection Values { get; }
member this.Values : System.Collections.ICollection
[<System.ComponentModel.Browsable(false)>]
member this.Values : System.Collections.ICollection
Public Overridable ReadOnly Property Values As ICollection

Property Value

An ICollection that contains the values in the DbConnectionStringBuilder.

Implements

Attributes

Examples

Note

This example includes a password to demonstrate how DbConnectionStringBuilder works with connection strings. In your applications, we recommend that you use Windows Authentication. If you must use a password, do not include a hard-coded password in your application.

static void Main()
{
    DbConnectionStringBuilder builder = new DbConnectionStringBuilder();
    builder.ConnectionString =
        "Provider=MSDataShape.1;Persist Security Info=false;" +
        "Data Provider=MSDAORA;Data Source=orac;" +
        "user id=username;password=*******";

    foreach (string value in builder.Values)
        Console.WriteLine(value);
}
Sub Main()
    Dim builder As New DbConnectionStringBuilder
    builder.ConnectionString = _
     "Provider=MSDataShape.1;Persist Security Info=False;" & _
     "Data Provider=MSDAORA;Data Source=orac;" & _
     "user id=username;password=*******"

    For Each value As String In builder.Values
        Console.WriteLine(value)
    Next
End Sub

Displays the following output:

MSDataShape.1
false
MSDAORA
orac
username
*******

Remarks

The order of the values in the ICollection is unspecified, but it is the same order as the associated keys in the ICollection returned by the Keys method.

The returned ICollection is not a static copy; instead, the ICollection refers back to the values in the original DbConnectionStringBuilder. Therefore, changes to the DbConnectionStringBuilder are reflected in the ICollection.

Applies to

See also