sb.Append("UPDATE Users AS u ");
sb.Append(" SET u.Reputation = (u.Reputation + @Repuation)");
sb.Append(" INNER JOIN Comments AS c ON c.UsersID=u.UsersID");
sb.Append(" WHERE c.CommentsID=@CommentsID");
它告诉我语法'AS'附近的语法不正确
答案 0 :(得分:3)
假设您正在使用MS SQL Server
,则SQL不正确应该是
UPDATE u
SET u.Reputation = (u.Reputation + @Reputation)
FROM Users u
INNER JOIN Comments c ON c.UsersID = u.UsersID
WHERE c.CommentsID = @CommentsID