请告诉我以下更新声明中的错误在哪里:
OleDbCommand updateCmd = new OleDbCommand("UPDATE [" + tableName + "]" +
" SET Password = ?, LastPasswordChangedDate = ?" +
" WHERE Username = ? AND ApplicationName = ? AND IsLockedOut = False", conn);
错误是
[OleDbException(0x80040e14):UPDATE语句中的语法错误。]
提前致谢
答案 0 :(得分:3)
PASSWORD一词是MS-Access Jet SQL的reserved keyword 如果你想在你的表中使用它,那么你需要用方括号
封装它OleDbCommand updateCmd = new OleDbCommand("UPDATE [" + tableName + "]" +
" SET [Password] = ?, LastPasswordChangedDate = ?" +
" WHERE Username = ? AND ApplicationName = ? AND IsLockedOut = False", conn);