@H_404_1@建表语句:create table classInfo(_id INTEGER PRIMARY KEY,name varchar(20),teacher varchar(20),classroom varchar(20),startWeek int,endWeek int);@H_404_1@
@H_404_1@ContentValues values = new ContentValues();
@H_404_1@ values.put("name",(String) classInfo[0]);
@H_404_1@ values.put("teacher",(String)classInfo[1]);
@H_404_1@ values.put("classroom",(String) classInfo[2]);
@H_404_1@ values.put("startWeek",(String) classInfo[3]);
@H_404_1@ values.put("endWeek",(String) classInfo[4])@H_404_1@;
@H_404_1@ dbInfo.insert("classInfo",null,values); //@H_404_1@其中dbInfo是数据库名,classInfo是表名
要点:
创建表的时候,定义Id 为INTEGER PRIMARY KEY,