SqlCommand cmd1 = new SqlCommand("INSERT INTO Userinformation(Access)
VALUES("+nameAccess.Text+") WHERE User_ID='"+userIdaccess.Text+"'",con);
SqlDataReader dr = cmd1.ExecuteReader();
if (dr.Read())
{
MessageBox.Show("User Access Blocked");
}
dr.Close();
它给出了一个例外,如下所示:
“关键字'WHERE'附近的语法不正确”