I'm connecting to a database using ODBC in my ASP.Net application where the password is something along the lines of:
pwd=abc"123
When I create the connection in my server explorer, it lets me put in the username and password and when I push the Test Connection button, it says the connection is successful. But when I hit the OK button, I get a bunch of errors along the lines of:
ERROR [28000] ... Invalid Password
ERROR [xxxxx] ... Invalid attribute in connection string: xxx
So, I decided to create my own connection string and place it in my web.config file manually.
Based upon suggestions from this solution, the connection string I created looks as follows:
<add name="ConnectionString" connectionString="Dsn=xxxx;...uid=xxxx;pwd='abc"123'"
I've tried a few other alternatives such as:
- Removing the
'
character surrounding thepwd
- Replacing the
'
characters also by"
- Replacing
"
with"
But none of these solutions are working for me.
And I know this is where the issue is coming from, because when I change the username and password to one that does not have a character that needs to be escaped, the application runs.
How can I get this password set correctly?