Last post Apr 07, 2016 05:57 PM by jp2code
Apr 05, 2016 02:36 PM|jp2code|LINK
My website is hosted, so I had been using the hosts connection string and database for a few months.
I am developing some new features now, and since the website is live I need to test these inserts before running through all of the records.
The remote database was setup using SQL Server Management Studio 2014 with a connection to the remote database.
I tried stepping through these in Visual Studio 2015 Pro, but the host does not allow remote connections like that.
So, I backed up the remote database and restored it to my local machine.
I went into the Database Connection's Properties > Settings to make sure both SQL Server and Windows Authentication mode were allowed.
I also added my database user and set him as the 'db_owner' for that database.
When I try to open the database in the VS2015 debugger, I get "Login failed for user".
What did I forget to do?
Apr 05, 2016 03:37 PM|Mikesdotnetting|LINK
You probably need to synchronise the user account your are trying to use with an existing SQL Server login on your server/machine. You can do this by running the following command against your database
sp_change_users_login 'update_one', 'user', 'user'
where 'user' is the name of the account you are trying to connect with.
Apr 05, 2016 05:22 PM|jp2code|LINK
Maybe I did something wrong.
Do I need to restart the server after doing that?
In the pic below, you can see I ran the command, but then I still got the same error when I tried to open the connection.
Apr 05, 2016 05:50 PM|jp2code|LINK
I also tried logging into the local connection using that same account, but it failed too.
That user is only in that one database (mcl959), so I don't know if it even should be able to log into the SQL Server instance.
I ran this command to change the password, and it completed with no errors.
> ALTER LOGIN [mcl959_admin] WITH PASSWORD=N'NewPassword', DEFAULT_DATABASE=[mcl959], DEFAULT_LANGUAGE=[us_english], CHECK_EXPIRATION=OFF, CHECK_POLICY=OFF
Instead of N'NewPassword", I pasted in the actual password from my Web.config file.
I went back and re-ran my website, but it still will not let that account log in.
I'm going to try a reboot....
Apr 07, 2016 05:57 PM|jp2code|LINK
Reboot fixed whatever the issue was.