By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,202 Members | 1,477 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,202 IT Pros & Developers. It's quick & easy.

Is there any function to solve the string to values?

P: n/a
ABC
Is there any function to solve the string to values?

for example:

The string is "data source=DEVSRV;Initial Catalog=MyDATABASE;User
ID=sa;Password=;".

I expected the function can return the value of "data source" is DEVSRV,
"Initial Catalog" is MyDatabase, "User ID" is sa, "Password" is empty
string.
Jan 26 '07 #1
Share this Question
Share on Google+
1 Reply


P: n/a

Well, if you know it is always a simple string you could just Spilt or
Regex it, but if you need something more generic:

DbConnectionStringBuilder builder = new
DbConnectionStringBuilder();
builder.ConnectionString = @"data source=DEVSRV;Initial
Catalog=MyDATABASE;User ID=sa;Password=;";
foreach (string key in builder.Keys) {
Console.WriteLine(key + " is " + builder[key]);
}

Marc

Jan 26 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.