发布网友
共1个回答
热心网友
string s = "select count(*) from staff where staffNo ='" + uu.Program.id + "'and code ='" + textBox10.Text.ToString() + "'"; //定义SQL语句
SqlConnection con = new SqlConnection("database=suppermarket;server=(local);integrated security=true");
SqlCommand cmd = new SqlCommand(s, con);
con.Open();
int count = (int)cmd.ExecuteScalar();
if (count > 0)
{
if (textBox11.Text.ToString() == textBox12.Text.ToString())
{
string o;
o = "update staff set code ='" + textBox11.Text.ToString() + "' where staffNo ='" + uu.Program.id + "'and code ='" + textBox10.Text.ToString() + "'"; //定义SQL语句
SqlCommand cmd4 = new SqlCommand(o, con);
cmd4.ExecuteNonQuery();
MessageBox.Show("密码修改成功!", "提示框");
textBox10.Text = "";
textBox11.Text = "";
textBox12.Text = "";
}
else
{
MessageBox.Show("两次密码输入不相等,请重新输入!", "提示框");
textBox10.Text = "";
textBox11.Text = "";
textBox12.Text = "";
}
}
else
{
MessageBox.Show("密码错误!,请重新输入", "提示框");
textBox10.Text = "";
textBox11.Text = "";
textBox12.Text = "";
}
热心网友
string s = "select count(*) from staff where staffNo ='" + uu.Program.id + "'and code ='" + textBox10.Text.ToString() + "'"; //定义SQL语句
SqlConnection con = new SqlConnection("database=suppermarket;server=(local);integrated security=true");
SqlCommand cmd = new SqlCommand(s, con);
con.Open();
int count = (int)cmd.ExecuteScalar();
if (count > 0)
{
if (textBox11.Text.ToString() == textBox12.Text.ToString())
{
string o;
o = "update staff set code ='" + textBox11.Text.ToString() + "' where staffNo ='" + uu.Program.id + "'and code ='" + textBox10.Text.ToString() + "'"; //定义SQL语句
SqlCommand cmd4 = new SqlCommand(o, con);
cmd4.ExecuteNonQuery();
MessageBox.Show("密码修改成功!", "提示框");
textBox10.Text = "";
textBox11.Text = "";
textBox12.Text = "";
}
else
{
MessageBox.Show("两次密码输入不相等,请重新输入!", "提示框");
textBox10.Text = "";
textBox11.Text = "";
textBox12.Text = "";
}
}
else
{
MessageBox.Show("密码错误!,请重新输入", "提示框");
textBox10.Text = "";
textBox11.Text = "";
textBox12.Text = "";
}