If you wanted to get really excited you could use Regular Expressions:
In VB.NET (I doubt the C# is a million miles away) :
'don't forget to import the namspace
Imports System.Text.RegularExpressions
'later...
'we're assuming a SQL Server connection string here and SQL Server
'Authentication
Dim regExp as new Regex("server=\w*;")
Dim m Match
m = regExp.Match(strDBConnectionString, "pwd=\w*;")
If m.Success Then
'you've found it...
End If
Notice the "\w*" bit is searching for a "word" in the phrase searched.
This would work with the other bits of the connection string too by tweaking
the expression BUT I have found the "word" gets confused if your server is
being identified by an IP address instead of it's name...
Probably all those "."'s :)
al*****@yahoo.com
"Bill" wrote:
If, for example, I retrieve a connectionstring from a config file using
something like:
Value = ConfigurationSettings.AppSettings["ConnectionString"];
This will return a string that is semi-colon delimited. If I want, say, to
retrieve the password from this string will I need to explicity parse it?