我试图更新数据库中的数据,但它显示了一个异常,即“=”附近的语法不正确。
SqlCommand cmd = new SqlCommand("upgrade LoginForm set Password ='" + txtConPassword.Text + "' where UserName ='" + txtUser.Text + "' ", conn);
var test = cmd.ExecuteNonQuery();
if (test == 1)
{
MessageBox.Show("Password has been reset");
}
else
{
MessageBox.Show("Password did not reset");
}
}
catch (Exception ex)
{
MessageBox.Show("Failed....." + ex.Message);
}