IDbConnection eats the password?

  • Thread starter Thread starter Developer
  • Start date Start date
D

Developer

Hello,

When this code executes:
if (dbConnection.State != ConnectionState.Open)
{
dbConnection.Open(); /* 1 */
return (true); /* 2 */
}

At 1, dbConnection.ConnectionString is "DSN=Grace SQL
Server;Uid=iron;Pwd=fillings;"
At 2, after the call to Open(), the connection string is "DSN=Grace SQL
Server;Uid=iron;"

Why is that, and is it preventable?

Thanks.
CB
 
Here is the "get" code out of the property ...

public string get_ConnectionString()
{
if (this._connectionString == null)
{
return "";
}
if (this._fShowPassword)
{
return this._connectionString;
}
return ConStringUtil.RemoveKeyValuesFromString(this._connectionString,
"password");
}

I don't think it's preventable and it's probably for security reasons. (Can
you inherit from SqlConnection?)

- Sahil Malik
You can reach me thru my blog at
http://www.dotnetjunkies.com/weblog/sahilmalik
 
Back
Top