这是我在项目中用于从表“帐户”中删除记录的代码,
using (OneViewEntities context = new OneViewEntities())
{
var AccountDelete = (from a in context.accounts
where a.id == accountId && a.userid == userId
select a).SingleOrDefault();
context.accounts.DeleteObject(AccountDelete);
context.SaveChanges();
return true;
}
但是此代码在执行 context.SaveChanges() 时会引发异常。这是错误详细信息。
InnerException = {"You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(SELECT\n `account`.`id`, \n `account`.`isprimary`, \n `account`.`na' at line 1"}