Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQL Server 2008 and Connection String

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

like image 205
Matthew Avatar asked Jun 12 '26 15:06

Matthew


2 Answers

Because you have Integrated Security=True". If you need to use password, change it to false.

like image 114
Alexan Avatar answered Jun 15 '26 05:06

Alexan


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.

like image 33
Amit Singh Avatar answered Jun 15 '26 06:06

Amit Singh