Caused by: java.lang.IllegalStateException: get fi

2019-08-20 03:37发布

i want to select value from my database but i got error

Caused by: java.lang.IllegalStateException: get field slot from row 0 col -1 failed

i don't know where is the wrong in my code.. this is my code in dbHelper.

public Cursor pilihEnkripsi( String chiperteks ) {
    Cursor c = dba.rawQuery("SELECT idenkripsi FROM TB_enkripsi where chiperteks = '"+chiperteks+"'", null);
    return c;
}

and i want to get the value in other class. i use this code.

Cursor cursorEnkripsi = data.pilihEnkripsi(ciper);
    if(cursorEnkripsi.moveToFirst()) {
        idenkripsi = cursorKontak.getString(cursorKontak.getColumnIndex("idenkripsi"));
    }

can somebody help me? i really need the solution, please help me.. thanks.. Regards..

1条回答
迷人小祖宗
2楼-- · 2019-08-20 03:58

Cursor cursorKontak should be cursorEnkripsi

Cursor cursorEnkripsi = data.pilihEnkripsi(ciper);
    if(cursorEnkripsi.moveToFirst()) {
        //idenkripsi = cursorKontak.getString(cursorKontak.getColumnIndex("idenkripsi"));
          idenkripsi = cursorEnkripsi.getString(cursorEnkripsi.getColumnIndex("idenkripsi"));
    }
查看更多
登录 后发表回答