I have the following connectionString string
:
"DataSource=R7gIrRzkARUJsQBUYXKCPpH8MdqtQ5Sd+lt4kyBEZBY=; userid=weRGgY7PERBTg2WPPzVerIlMP93kmQbTSuKsJKyDHFU=; password=qcMxEGU75lJ1VD5OaaujnLzleR/7ZQDco3kddfwTOvI=;"
After I pass the string to a decrypt function, I will use it in the following:
iDB2Connection.ConnectionString = connectionString;
My question is, what's the best way to decrypt the values in the connectionString string?
One possibility was to convert the string to a DataSet
and call the following code:
String connection = dsConnection.Tables[0].Rows[0]["connectionstring"].ToString();
SqlConnectionStringBuilder DBConfig = new SqlConnectionStringBuilder(connection);
string ConnectionString =
"Data Source=" + Decrypt(DBConfig.DataSource)
+ ";Initial Catalog=" + Decrypt(DBConfig.InitialCatalog)
+ ";User ID=" + Decrypt(DBConfig.UserID)
+ ";Password=" + Decrypt(DBConfig.Password);
but I haven't figured out how to do that successfully.
Any help is appreciated.