private void pboxLogin_Click(object sender, EventArgs e)
{
if (validateInput())
{
string sql = "select count(*) from tb_user where ID=" + int.Parse(txtID.Text.Trim()) + "and Pwd=" + txtPwd.Text.Trim() + "";
int num = dataoper.ExecSQL(sql);
if (num == 1)
{
PublicClass.loginID = int.Parse(txtID.Text.Trim());
if (cboxremember.Checked)
{
dataoper.ExecSQLResult("updata tb_User set Remember=1 where ID=" + int.Parse(txtID.Text.Trim()));
if (cboxAutoLogin.Checked)
dataoper.ExecSQLResult("update tb_User set AutoLogin=1 where ID=" + int.Parse(txtID.Text.Trim()));
}
else
{
dataoper.ExecSQLResult("update tb_User set Remember=0 where ID=" + int.Parse(txtID.Text.Trim()));
dataoper.ExecSQLResult("update tb_User set AutoLogin=0 where ID=" + int.Parse(txtID.Text.Trim()));
}
dataoper.ExecSQLResult("updata tb_User set Flag=1 where ID" + int.Parse(txtID.Text.Trim()));
Frm_Login frmMain = new Frm_Login();
this.Visible = false;
}
else
{
MessageBox.Show("输入用户名或密码有误", "登录提示", MessageBoxButtons.OK, MessageBoxIcon.Error );
}
}
}