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.
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.
Raja TPosted Sep 8, 2015, 12:26 AM
sda .Fill (ds,"Login");
{
String role = ds.Tables[0].Rows[0]["Role "].ToString();//here check admin login/client login
if(role=="admin")
}
Milisav RadivojevicPosted Sep 8, 2015, 7:52 AM
Raja TPosted Sep 8, 2015, 12:16 AM
Milisav RadivojevicPosted Sep 7, 2015, 1:31 PM
Raja TPosted Sep 7, 2015, 12:46 PM
con.Open();
SqlCommand cmd=new SqlCommand("select username,password,role from Login ",con);
SqlDataAdapter da=new SqlDataAdapter (cmd);
DataSet ds=new DataSet ();
da.Fill (ds,"Login");
string v1,v2,v3;
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{
v1 = ds.Tables[0].Rows[i][0].ToString();
v2 = ds.Tables[0].Rows[i][1].ToString();
v3 = ds.Tables[0].Rows[i][2].ToString();
//here store the value v3(role) in Session/global variable
}
Here check role
If(v3==" admin")
{
//here admin code
}else
{
//here client code
}