xaml - Login administrator c# from local database bug -
i have problem when try connect admin c# application.
i have created local database stock main informations such username, password...
when user enter login interface, enter user name , password, click login this:
<textbox name="usernamebox"></textbox> <passwordbox name="passwordbox"></passwordbox> <button content="connection" click="connectionclick"></button>
the event click role check if admin can log in, or not:
private void connectionclick(object sender, routedeventargs e) { var username = usernamebox.text; var password = passwordbox.password; admin admin = new admin(); if((username == admin.username) && (password == admin.password)) { this.close() mainpage retourpageprincipale = new mainpage(); retourpageprincipale.show(); } else { messagebox.show("bad username/password combo!"); } }
i have created fake users local database (admin) , when enter correct login/password, have messagebox. have messagebox.
does know doing wrong?
i won't give answer, show should done in such cases:
- try debug - put break point in line
if((username == admin.username) && (password == admin.password))
, using watch expression try find out problem - if step 1 impossible - try log file, remember after find bug delete logging because log admin password :)
above steps should give answer
Comments
Post a Comment