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.........
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
pavi thraPosted Feb 20, 2009, 6:33 AM
sarath phaniPosted Feb 18, 2009, 12:07 AM
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();
}