I want to get connection string components from a string containing the conn string.
It is pretty simple to get Database, Sql Instance , Username and Password using a SqlConnectionStringBuilder, like this:
SqlConnectionStringBuilder cb = new SqlConnectionStringBuilder(cString);
this.textBoxUsername.Text = this.UserName = cb.UserID;
this.textBoxPassword.Text = this.Password = cb.Password;
...
My problem is that i want to get the TrustedConnection also, and i don't know how to do it.
Having the conn string "Server=Me\SQLEXPRESS;Database=AWEBL; Connection Timeout = 30;" Trusted_Connection=True;" , is it any other way than parsing the cString (connection string) to get the Trusted_Connection property ?
Thank you!
set:
cb["Trusted_Connection"] = true;
get:
var trustedConnection = cb["Trusted_Connection"];