2014-03-04 149 views
-1
INSERT INTO saved_locations (CharacterID, Index, MapleID) 
VALUES ('10', '0', '100020000') 

的錯誤是:MySql查詢錯誤?

MySql.Data.MySqlClient.MySqlException (0x80004005: 
You have an error in your SQL syntax; check the manual that 
corresponds to your MySQL server version for the right syntax to use 
near 'Index, MapleID) VALUES ('10', '0', '100020000')' at line 1 

爲什麼我得到的錯誤?這太奇怪了。我的桌子很好。

回答

5

Index是保留字。您需要引用它:

INSERT INTO saved_locations (CharacterID, `Index`, MapleID) 
    VALUES ('10', '0', '100020000') 
+0

謝謝!我不知道。 – user3265040

+1

我們隨時爲您服務。 :-) –

+1

更好的是,避免使用保留字作爲列名/表名。 – Raptor