前几天在c#用SQL语句创建一个表“CREATE TABLE Metero (year Integer,month Integer,day Integer,temperature Single); ”是程序老提示该语句错误,百思不得其解,后通过网络搜索发现,year,month,day均为sql,Access的保留字或关键字。但是我非用这几个字段名不可,怎么办呢?
其实很简单,只须把字段名的放在“[]”中就OK了,正确的SQL语句应该是“CREATE TABLE Metero ([year] Integer,[month] Integer,[day] Integer,temperature Single); ”