SQLDBA SQLDBA - 1 year ago 102
SQL Question

SQL Server 2008 password ending in a semicolon

Let's say I have a password that looks like this: password;

How can I get it to work with a semicolon as the last character. The password works in SSMS and ODBC, but not with the connection string. I've tried

around it but that does not seem to work.

<add name="DbConn" connectionString="Data Source=LOCALHOST;Database=MYDB;Trusted_Connection=no;User Id=myuser;Password=password;" providerName="System.Data.SqlClient" />

This is for an ASP.NET web application. As far as I can tell, it is impossible.

Answer Source

I am using the following code to connect to SQL Server 2008 R2.

  var sqlConnection = new SqlConnection()
                ConnectionString = "Server=DT2719MOD;Database=abs2;User Id=TestUserLogon;Password='iloveachallenge;';"


Edit: Also tried to use the connection string that you have and it works on my machine.

ConnectionString="Data Source=DT2719MOD;Database=abs2;Trusted_Connection=no;User Id=TestUserLogon;Password='iloveachallenge;';" 
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download