为什么我答应的log全是字段名_id,name,age
SQLiteDatabase db = openOrCreateDatabase("list1.db", MODE_PRIVATE, null);
db.execSQL("create table if not exists tab1(_id integer primary key autoincrement,name text not null,age integer not null)");
ContentValues values = new ContentValues();
values.put("name", "戚继光");
values.put("age", 20);
long rowid = db.insert("tab1", null, values);
values.clear();
values.put("name", "CHEN");
db.update("tab1", values, "name like ?", new String[]{"%光%"});
Cursor cursor = db.query("tab1", null,null, null, null, null, null);
if(cursor !=null ){
String[] s = cursor.getColumnNames();
while(cursor.moveToNext() ){
for (String ColumnNames: s) {
android.util.Log.d("日志", ColumnNames);
}
}
cursor.close();
}
db.close();