1.怎样在数据库中一次插入多条数据?
DBHelper mDbHelper = new DBHelper(getApplication());
sqliteDatabase db = mDbHelper.getWritableDatabase();
String sql = "insert into logtable(name,urls,dece)values('梨花','荷花','木槿'),"('月季','牡丹','菊花')";
db.execsql(str);
2.怎样查找几条数据,但前几条跳过去?
sqliteDatabase db = mHelper.getWritableDatabase();
String sql = "select * from logtable limit 1,2";//这个事查找两条数据这两条数据之前的一条跳过去。
String sql = "select * from logtable limit 1,2";//这个事查找两条数据这两条数据之前的一条跳过去。
Cursor c = db.rawQuery(sql,null);
//Cursor cccc=db.query("logtable",null,"name like '%"+88+"%'",null);
//Cursor cccc=db.query("logtable","name like ?",new String[]{"%"+8+"%"},null);
Cursor cccc=db.rawQuery("select * from logtable where name like '%"+"mlz"+"%'",null);
//Cursor cccc=db.query("logtable","name like ?",new String[]{"%"+8+"%"},null);
Cursor cccc=db.rawQuery("select * from logtable where name like '%"+"mlz"+"%'",null);