近期在unity访问MySQL时报了错误:
Exception: SQL:Select force FROM ai1-01 WHERE id < ‘662’/nYou have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘force FROM ai1-01 WHERE id < ‘662’’ at line 1
意思是使用SQL语法不正确,查了半天还是没发现有什么毛病,最后再MySQL控制台执行语句:select force from ai1-01
也报错误,
搞了一下午,发现是在创建表格以force为栏位名,但是force为MySQL的 MySQL 的保留字,对于保留字的使用需要加单引号,即
force
,再执行select
forcefrom ai1-01
成功。