创建表
public static final String STEPTABLE = "create table if not exists step_info(_id INTEGER PRIMARY KEY,day TEXT ,date TEXT, startStep INTEGER)";
db.execSQL(STEPTABLE);
表里面插入元素
db.execSQL("alter table step_info add startStep INTEGER ");
插入数据
String insertStepSql = "insert into step_info(day,date,startStep)values(?,?,?)";
db.execSQL(insertStepSql, new Object[] { item.day,item.date, item.startStep });
更新数据
String updateStepSql = String.format("update step_info set day='%s',date='%s',startStep='%s' where day='%s'", item.day,item.date, item.startStep,item.day);
db.execSQL(updateStepSql);
查询数据
String selectStepSql = String.format("select * from step_info where day='%s'", item.day);
Cursor cursor=db.rawQuery(selectStepSql, null);