Partager via


DataConnectionProperties.GetValueAsString Method

Formats a property value for placement in a connection string.

Namespace:  Microsoft.VisualStudio.Data
Assembly:  Microsoft.VisualStudio.Data (in Microsoft.VisualStudio.Data.dll)

Syntax

'Declaration
Protected Overridable Function GetValueAsString ( _
    propertyName As String _
) As String
protected virtual string GetValueAsString(
    string propertyName
)
protected:
virtual String^ GetValueAsString(
    String^ propertyName
)
abstract GetValueAsString : 
        propertyName:string -> string  
override GetValueAsString : 
        propertyName:string -> string
protected function GetValueAsString(
    propertyName : String
) : String

Parameters

  • propertyName
    Type: System.String

    The name of a property to be formatted.

Return Value

Type: System.String
Returns the value of the specified property in a string format suitable for placement in a connection string.

Exceptions

Exception Condition
ArgumentNullException

The name parameter is null.

InvalidOperationException

The property does not exist.

Remarks

This method is called by the base implementation of ToDisplayString and ToFullString when formatting property values to be placed in the output string.

The base implementation of this method gets the PropertyDescriptor for the property and uses its TypeConverter to produce a string representation, then it applies the following formatting rules:

  1. If the property value is an Enum type that is marked with the FlagsAttribute, replace every comma (",") with a pipe ("|");

  2. If the property value contains one or more single quotes ('), change each to two single quotation marks ('');

  3. If the name/value separator or property entry separators (as specified in the constructor) contains one or more double quotes("), equal signs (=), or semicolons (;), then enclose the entire value in single quotation marks (').

.NET Framework Security

See Also

Reference

DataConnectionProperties Class

Microsoft.VisualStudio.Data Namespace