2013-03-12 63 views
1

我用Access數據庫編寫了一個Java程序我可以記錄字符串值,但是我爲數字編寫的查詢使用數字字段列生成一個INSERT INTO錯誤。以下是查詢和錯誤。訪問插入錯誤:輸入數字訪問編號字段

Level - Col in table with number field 

Access Insert Statement: 
INSERT INTO SystemEquipment(Level) Values (12); 

Error: 
[Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO statement. 

**Tried to run the query with and without single quotes and semicolons 

回答

4

因爲LEVEL是保留關鍵字。您必須使用[]

INSERT INTO SystemEquipment([Level]) Values (12); 

從MS Access文件逃吧,

If a reserved word is already in use, you can avoid error messages by surrounding each occurrence of the word with brackets ([]) . However, the best solution is to change the name to a nonreserved word.