1

您能否告诉我以下更新语句中的错误在哪里:

OleDbCommand updateCmd = new OleDbCommand("UPDATE [" + tableName + "]" +
                " SET Password = ?, LastPasswordChangedDate = ?" +
                " WHERE Username = ? AND ApplicationName = ? AND IsLockedOut = False", conn);

错误是

[OleDbException (0x80040e14): UPDATE 语句中的语法错误。]

提前致谢

4

1 回答 1

3

PASSWORD 这个词是 MS-Access Jet SQL 的保留关键字
如果你想在你的表中使用它,那么你需要用方括号将它封装起来

OleDbCommand updateCmd = new OleDbCommand("UPDATE [" + tableName + "]" +
            " SET [Password] = ?, LastPasswordChangedDate = ?" +
            " WHERE Username = ? AND ApplicationName = ? AND IsLockedOut = False", conn);
于 2013-10-27T22:57:58.163 回答