When debugging it is useful to display the connection string but what you do not want is to disclose the password. So I wrote a function StripConnectionPassword to strip the connection string of any password.
The function takes a string like:
Provider=SQLOLEDB.1;Password=DINGBAT;Persist Security Info=True;User ID=DINGBAT;Initial Catalog=tempdb;Data Source=DALET
and returns:
Provider=SQLOLEDB.1;Password=...;Persist Security Info=True;User ID=DINGBAT;Initial Catalog=tempdb;Data Source=DALET
The function can be downloaded as part of the CommonData and CommonFilter projects from CodePlex.