删除使用Linq到Mysql没有发生

时间:2013-02-22 06:07:57

标签: c# mysql linq

以下是我在项目中用于从表'account'中删除记录的代码,

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"}

0 个答案:

没有答案