Andoid Sqlite 增查

来源:互联网 发布:mac实用软件推荐 编辑:程序博客网 时间:2024/05/18 10:21
SQLiteDatabase demoSQLite = this.openOrCreateDatabase("Sqllite_demo.db", Context.MODE_PRIVATE, null);//String sql = "Create table test1(id int)";//for(int i = 0;i<10;i++){//String sql = "insert into test1(id) values("+i+")";//demoSQLite.execSQL(sql);//}//Cursor cursor = demoSQLite.rawQuery("select * from test1", null);int i = 0;if(cursor != null){if(cursor.moveToFirst()){do{System.out.println(cursor.getString(0));//i++;}while(cursor.moveToNext());}}


0 0