Click here to Skip to main content
15,891,657 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
My winform app connects with SQL Server (2008). It uses only Windows authentication at the moment, but I was given a task to allow SQL Server logins also.

I am not sure how to test if my code really uses SQL Server login and not Windows login.

Is there something I can do here?
Posted

All you have to do is change the connection string: remove
Integrated Security=true
and add the SQL username and password instead:
C#
Server=ServerAddress;Database=DataBaseName;User Id=MyUserName;
Password=MyPassword;


See here: http://www.connectionstrings.com/sql-server-2008/[^]
 
Share this answer
 
Even though your question is too much broad, I guess this can help:

You’ll need to create a new SQL Server login with all necessary permissions. Then, you’ll need to update your app’s connection strings (do consolidate them in one config file before updating).

After that, you should add a login form to your application (for a user to enter credentials), which will be shown at the app startup.

To conduct your testing, just disable your windows user in SQL Server and check to see if the app is still running.

Hope I helped.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900