private void btnOK_Click(object sender, EventArgs e)
{
btnOK.Enabled = false;
try
{
DataTable dt = userBal.GetTable(" UserName='" + txtUserName.Text.ToString().Trim() + "' and UserPwd='" + txtUserPwd.Text.ToString().Trim() + "'");
if (dt.Rows.Count > 0)
{
UserSate.userid = dt.Rows[0]["ID"].ToString();
UserSate.userpower = dt.Rows[0]["UserPower"].ToString();
frmMain frm = new frmMain();
frm.Show();
this.Hide();
}
else
{
MessageBox.Show("对不起,用户名或密码不对!");
}
}
catch
{
MessageBox.Show("对不起,用户名或密码错误!");
}
finally
{
btnOK.Enabled = true;
}
}