我需要在下面的这些语法中使用 ExecuteNonQuery 吗?他们是正确的吗?目标使用da.DeleteCommand;我获得了哪种语法?
MySqlCommand cmd = new MySqlCommand("DELETE FROM users_login WHERE UserID = @UserID;", coon);
cmd.Parameters.Add("@UserID", MySqlDbType.Int16).Value = oUsuario.UserID;
MySqlDataAdapter da = new MySqlDataAdapter();
da.DeleteCommand = cmd;
coon.Open();
ok = true;
/**OR use this**/
MySqlCommand cmd = new MySqlCommand("DELETE FROM users_login WHERE UserID = @UserID;", coon);
cmd.Parameters.Add("@UserID", MySqlDbType.Int16).Value = oUsuario.UserID;
coon.Open();
cmd.ExecuteNonQuery();
ok = true;