dimanche 9 octobre 2016

If else statement involving data from MS Access

I am very new to programming and C#. I would like to know how to compare a data from ms access database in if else statement.

For example, I have DBConnectivity.getAdminInfo() from DBconnectivity class. I also have another class for admin which contain set and get methods. Now I want to compare the data in my aspx c# code. like

if (usernameTxt.Text == DBDBConnectivity.getAdminInfo()) && (Password.Text == DBDBConnectivity.getAdminInfo())  {
    label1.Text= "login success"; 
} 
else 
{
    label1.Text= "wrong username or password"; 
}

But it didn't work.

I am sorry, I couldn't post my code because this is the first time I'm using this website and it did not allow me to post because of some indent issue.

Please help me with some example if possible. Thank you very much

Aucun commentaire:

Enregistrer un commentaire