Reputation: 4607
I have created a login in SQL Server 2008 with username= smart_provider and password = password.
Now, I added the following connection string to my project:
<add name="DB_Connection"
connectionString="data Source=.\MATTHEW;Initial Catalog=Provider;User Id=smart_provider;Password=password;Integrated Security=True"
providerName="System.Data.SqlClient"/>
Now, for some reason or another, even if I change the password to an incorrect one, the program still works and fetches the data from the database? What am I doing wrong please? Thank you
Upvotes: 3
Views: 325
Reputation: 113
Make Integrated Security = false and you should be good.
Integrated Security = False : User ID and Password are specified in the connection. Integrated Security = true : the current Windows account credentials are used for authentication.
Hope this helps.
Upvotes: 2
Reputation: 8635
Because you have Integrated Security=True"
. If you need to use password, change it to false.
Upvotes: 4
Reputation: 1258
Change Integrated Security to false and it will fail. MS Docs:
When false, User ID and Password are specified in the connection. When true, the current Windows account credentials are used for authentication. Recognized values are true, false, yes, no, and sspi (strongly recommended), which is equivalent to true.
Upvotes: 2
Reputation: 8109
Set Integrated Security=false;
"Integrated Security" or "Trusted_Connection" When false, User ID and Password are specified in the connection. When true, the current Windows account credentials are used for authentication. If User ID and Password are specified and Integrated Security is set to true, the User ID and Password will be ignored and Integrated Security will be used.
Upvotes: 3