Message box
i am developing a login page where i need to give the error message if user enters invalid details otherwise check it to throgh c# from the database. I am not able to display error message throgh popup. anybody can help me plz.........
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.

sarath phani13 reputationPosted Feb 17, 2009, 7:07 PM EST
private
void button1_Click(object sender, EventArgs e){
SqlCommand myComm = new SqlCommand("select um_name,um_pwd from user_master ", con);
Boolean check=false;
con.Open();
SqlDataReader myReader = myComm.ExecuteReader();
while (myReader.Read())
{
if ((textbox1.Text.Trim().ToUpper() == myReader["um_name"].ToString().Trim().ToUpper())
&& (textbox2.Text.Trim() == myReader["um_pwd"].ToString().Trim()))
{
check=true;
MessageBox.Show("Your login was successful!");
break;
}
}
if (check != true)
{
MessageBox.Show("Your login was not successful, Please try agin!");
textbox1.Text = string.Empty;
textbox2.Text = string.Empty;
}
con.Close();
}
pavi thra3 reputationPosted Feb 20, 2009, 1:33 AM EST