Share via


ConnectionArgument.Value Property

Gets or sets a value that specifies the value of the connection argument.

Namespace:  Microsoft.Web.Management.DatabaseManager
Assembly:  Microsoft.Web.Management.DatabaseManager (in Microsoft.Web.Management.DatabaseManager.dll)

Syntax

'Declaration
Public Property Value As String
'Usage
Dim instance As ConnectionArgument
Dim value As String

value = instance.Value

instance.Value = value
public string Value { get; set; }
public:
property String^ Value {
    String^ get ();
    void set (String^ value);
}
function get Value () : String
function set Value (value : String)

Property Value

Type: System.String
The value of the connection argument.

Examples

The following code sample illustrates an example ConnectionStringArgument property that returns the connection string arguments for a Microsoft Access database provider.


    Public Overrides Function CalculateConnectionString( _
            ByVal arguments As System.Collections.Generic.ICollection( _
            Of Microsoft.Web.Management.DatabaseManager.ConnectionArgument)) As String

        Dim builder As OleDbConnectionStringBuilder = New OleDbConnectionStringBuilder
        For Each argument As ConnectionArgument In arguments
            Select Case (argument.Name)
                Case "Provider"
                    builder.Provider = argument.Value
                Case "Data Source"
                    builder.DataSource = argument.Value
                Case "Jet OLEDB:Database Password"
                    builder.Add(argument.Name, argument.Value)
                Case Else
                    Throw New ArgumentException(String.Format("The argument {0} is unexpected for this database provider!", argument.Name))
            End Select
        Next
        Return builder.ToString

    End Function


        public override string CalculateConnectionString(
            ICollection<ConnectionArgument> arguments )
        {
            OleDbConnectionStringBuilder builder = new OleDbConnectionStringBuilder();

            foreach (ConnectionArgument argument in arguments)
            {
                switch (argument.Name)
                {
                    case "Provider":
                        builder.Provider = argument.Value;
                        break;
                    case "Data Source":
                        builder.DataSource = argument.Value;
                        break;
                    case "Jet OLEDB:Database Password":
                        builder.Add(argument.Name, argument.Value);
                        break;
                    default:
                        throw new ArgumentException(String.Format("The argument {0} is unexpected for this database provider!", argument.Name));
                }
            }
            return builder.ToString();
        }

Permissions

See Also

Reference

ConnectionArgument Class

Microsoft.Web.Management.DatabaseManager Namespace