SQLiteDatabase db = this.openOrCreateDatabase("students", MODE_PRIVATE, null);
/* db.execSQL("create table info (" +
"id integer PRIMARY KEY autoincrement," +
"name text);" );*/
// db.execSQL("insert into info (name) values ('Ahmed');");
// db.execSQL("insert into info (name) values ('Ali');");
Toast.makeText(this, "databse done and informations inserted succesfully", Toast.LENGTH_LONG).show();
Cursor c1 = db.rawQuery("select * from info where name = 'ahmed';", null);
//this line gives runtime error
String x = c1.getString(c1.getColumnIndex("name"));
Toast.makeText(this, x, Toast.LENGTH_LONG).show();
質問する
48 次