WPF user authentication against SQL database with 2 roles

Sep 7 2015 12:11 PM
Hi guys,

First I want to thank you for your great knowledge sharing. I have project in school to do this week in VS 2013 C#. WPF(not Win-forms)
Login window with user authentication against MS SQL database with 2 different roles: Admin and Client(open Window1 on success login). I have connected my DB with my WPF fine. I have 1 question if you can help.
 
In my SQL DB I have made table "users" with this columns("id, username, password, role") I need to have only 1 Admin so I assigned 1st user with id "1" and username "admin", password "pass" and Role "Admin". Rest 3 users I made are assigned as "Client" in "Role" Column. How can I use Role column on button_click event handler to authorize 2 different access Roles or levels

My MainWindow.Xaml.cs: http://pastebin.com/xDk823JE
My Xaml Designer Code: http://pastebin.com/9jkyhXFF

Any help is much appreciate, uploaded complete project if you want to take a look and help me out with this. Just need simple, non-secured working example, advice, pointers.
Thanks a lot.

Attachment: wpfapplication1.zip

Answers (5)