2013-03-12 61 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.