当我创建新表时:
private static final String SQL_CREATE_AREAS = "CREATE TABLE IF NOT EXISTS `cs_area` (" +
" `area_id` mediumint(6) NOT NULL AUTO_INCREMENT,"+
" `areaname` varchar(40) NOT NULL,"+
" PRIMARY KEY (`area_id`),"+
" KEY `areaname` (`areaname`)"+
") DEFAULT CHARSET=utf8 AUTO_INCREMENT=13 ;";
我收到了错误:
引起:android.database.sqlite.SQLiteException:near “AUTO_INCREMENT”:语法错误(代码1):,编译时:CREATE 表IF NOT EXISTS
cs_area
(area_id
mediumint(6)NOT NULL AUTO_INCREMENT,areaname
varchar(40)NOT NULL,PRIMARY KEY (area_id
),KEYareaname
(areaname
))DEFAULT CHARSET = utf8 AUTO_INCREMENT = 13;
也许,任何人都可以帮助我吗?感谢
答案 0 :(得分:0)
将AUTO_INCREMENT
更改为autoincrement
并告诉我们您的结果。
答案 1 :(得分:0)
AUTOINCREMENT
而非AUTO_INCREMENT
:http://www.sqlite.org/autoinc.html