SqlErrorExtensions.ExtractString Method
Parses a SqlError message and extracts the field identified by the key.
Namespace: Microsoft.TeamFoundation.Framework.Server
Assembly: Microsoft.TeamFoundation.Framework.Server (in Microsoft.TeamFoundation.Framework.Server.dll)
Syntax
'Declaration
<ExtensionAttribute> _
Public Shared Function ExtractString ( _
error As SqlError, _
key As String _
) As String
public static string ExtractString(
this SqlError error,
string key
)
[ExtensionAttribute]
public:
static String^ ExtractString(
SqlError^ error,
String^ key
)
static member ExtractString :
error:SqlError *
key:string -> string
public static function ExtractString(
error : SqlError,
key : String
) : String
Parameters
error
Type: System.Data.SqlClient.SqlErrorThe error to search
key
Type: System.StringWhich value to look for
Return Value
Type: System.String
The extracted string value, or the empty string if not found
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type SqlError. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
Remarks
Searches for the pattern %key=value% and returns value.
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.