F
Francois Malgreve
Hi,
I would like to know how I can do to retrieve the user and password from a
connection object.
All i see from SQLConnection is that i can access the connectionString but I
need to be able to access the specific user and password for that
connection.
If I parse the connection string myself i may not be able to catch the
values properly every times as there are many valid syntax to build a
connection string and I am pretty sure that I do not know all of them.
For example
"Data Source=Aron1;Initial Catalog=pubs;User Id=sa;Password=asdasd;"
is valid but
"Data Source=Aron1;Initial Catalog=pubs;User Id = sa;Password = asdasd;"
"Data Source=Aron1;Initial Catalog=pubs;uid=sa;Password =asdasd;"
"Data Source=Aron1;Initial Catalog=pubs;uid =sa;pwd=asdasd;"
and probably other syntaxes are valid.
I assume that internally the SqlConnection object parses the connection
string and store the user and password in separate fields. Is there any
public method or attribuate that can do that? Or any third party library?
Best regards,
Francois Malgreve.
I would like to know how I can do to retrieve the user and password from a
connection object.
All i see from SQLConnection is that i can access the connectionString but I
need to be able to access the specific user and password for that
connection.
If I parse the connection string myself i may not be able to catch the
values properly every times as there are many valid syntax to build a
connection string and I am pretty sure that I do not know all of them.
For example
"Data Source=Aron1;Initial Catalog=pubs;User Id=sa;Password=asdasd;"
is valid but
"Data Source=Aron1;Initial Catalog=pubs;User Id = sa;Password = asdasd;"
"Data Source=Aron1;Initial Catalog=pubs;uid=sa;Password =asdasd;"
"Data Source=Aron1;Initial Catalog=pubs;uid =sa;pwd=asdasd;"
and probably other syntaxes are valid.
I assume that internally the SqlConnection object parses the connection
string and store the user and password in separate fields. Is there any
public method or attribuate that can do that? Or any third party library?
Best regards,
Francois Malgreve.