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

两盒软妹~` 提交于 2020-01-07 03:22:03

问题


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:


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"));
    }


来源:https://stackoverflow.com/questions/16381598/caused-by-java-lang-illegalstateexception-get-field-slot-from-row-0-col-1-fai

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!