I need to fetch the 5555 and store it into a string or an integer
SQLiteDatabase db = openOrCreateDatabase("db_name", MODE_PRIVATE, null);
db.execSQL("CREATE TABLE IF NOT EXISTS DB_NAME(ID INTEGER(1),PASS INTEGER(4));");
db.rawQuery("INSERT INTO DB_NAME VALUES(1,5555);",null);
Cursor v= db.rawQuery("SELECT PASS FROM DB_NAME WHERE ID=1;",null);
String xyz;
if(v != null && v.moveToFirst()) {
xyz= v.getString(v.getColumnIndex("pass"));
t1.setText(xyz);
}
v.close();
db.close();
Now it's showing the following error
android.database.CursorIndexOutOfBoundsException: Index 0 requested, with a size of 0
Aucun commentaire:
Enregistrer un commentaire