Hey there,
I would suggest following modifications:
Change this definition to return
int
:
public void Getusernamepassword(Bussinessobject.BO EBO)
like:
public int Getusernamepassword(Bussinessobject.BO EBO)
and return the
count
that you get after
while (reader.Read())
{
count = 0 + 1;
}
like
return count;
and remove this code
if (count == 1)
{
MessageBox.Show("Your password is correct now enjoy application !!! ....");
return;
}
else if (count== 0)
{
MessageBox.Show(" Please Input right your Username and password plz check your spellings !!!!! ");
return;
}
if (count == 2)
{
MessageBox.Show ("Duplicate Username and Password !!!....");
return;
}
from
Getusernamepassword
method
and replace these lines
EBAL.Getusernamepassword(EBO);
this.Hide();
Masterpage mpage = new Masterpage();
mpage.Show();
of
button1_Click
method with
int count = EBAL.Getusernamepassword(EBO);
if (count == 1)
{
MessageBox.Show("Your password is correct now enjoy application !!! ....");
this.Hide();
Masterpage mpage = new Masterpage();
mpage.Show();
return;
}
else if (count== 0)
{
MessageBox.Show(" Please Input right your Username and password plz check your spellings !!!!! ");
return;
}
if (count == 2)
{
MessageBox.Show ("Duplicate Username and Password !!!....");
return;
}
Let me know if it helps.
Azee...