CursorIndexOutOfBoundException: 请求索引 -1,大小为 1

基帕尔·辛格 |

我如何执行检索 2 个字符串和 1 个整数值的选择语句。我收到此错误。我的应用程序一直在 cursor.getString(0) 处崩溃;在我的日志中,我确实收到了这条消息 Log.d("TAG","Row found");

登录.java

private void getQRCodeInformation(){
    //database helper object
    DatabaseHelper db;
    //initializing views and objects
    db = new DatabaseHelper(this);
    Cursor cursor = db.getQRCodeInformation();
    if(cursor.getCount() == 0) {
        Log.d("TAG","Nothing found");
    }
    else{
        Log.d("TAG","Row found");
        if(cursor != null && cursor.moveToFirst()){
            //cursor.getString(0);
            //cursor.getString(1);
            //cursor.getInt(1);
            Log.d("TAG","Data found");
        }
    }
}

数据库助手

public Cursor getQRCodeInformation(){
    SQLiteDatabase db = this.getReadableDatabase();
    String sql = "SELECT "+COLUMN_0_UserDetail+" , "+COLUMN_4_UserDetail+" , "+COLUMN_5_UserDetail+ " FROM "+ TABLE_NAME_UserDetail;
    Cursor c = db.rawQuery(sql, null);
    return c;
}
阿图尔·阿克诺扬

你只需要获取列的索引

int index = cursor.getColumnIndex(COLUMN_NAME);

然后

String columnValue = cursor.getString(index);

祝你好运 :)

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

Android Sqlite-异常:由于大小太大,请求索引-1,大小为32 ---?

来自分类Dev

CursorIndexOutOfBoundsException:已请求索引1,大小为1。错误-Android

来自分类Dev

android.database.CursorIndexOutOfBoundsException:已请求索引-1,大小为0

来自分类Dev

CursorIndexOutOfBounds 异常:请求索引 0,大小为 0

来自分类Dev

logcat错误索引-1请求,大小为24

来自分类Dev

android.database.CursorIndexOutOfBoundsException:已请求索引133,大小为133

来自分类Dev

android.database.CursorIndexOutOfBoundsException:已请求索引0,大小为0数据库错误

来自分类Dev

android.database.CursorIndexOutOfBoundsException:已请求索引0,游标的大小为0

来自分类Dev

Android.database.CursorIndexOutOfBoundsException:请求索引0,大小为0-s

来自分类Dev

CursorIndexOutOfBoundsException:请求索引0,在INSERT / SELECT上的大小为0

来自分类Dev

Error-CursorIndexOutOfBoundsException:已请求索引0,大小为0

来自分类Dev

android.database.CursorIndexOutOfBoundsException:请求索引0,Android中的错误大小为0

来自分类Dev

要求索引0,大小为0

来自分类Dev

要求索引2,大小为2

来自分类Dev

如何解决IndexOutOfBoundsException:无效的索引1,大小为1?

来自分类Dev

Android-从SQLite导出到文件时,接收到“索引-1请求,大小为4”的异常

来自分类Dev

JsArray <?>的大小为1,但得到“ java.lang.IndexOutOfBoundsException:索引:0,大小:0”

来自分类Dev

Android java.lang.IndexOutOfBoundsException:无效的索引1,大小为1

来自分类Dev

IndexError:索引1超出了轴0的范围,大小为1 / ForwardEuler

来自分类Dev

java.lang.IndexOutOfBoundsException:无效的索引1,在分段RecyclerView中,大小为1

来自分类Dev

Android-无效的索引1,大小为1-超出范围

来自分类Dev

java.lang.IndexOutOfBoundsException:索引:1,大小:1(以数组为单位)

来自分类Dev

if(data [i,1] == 1):IndexError:索引869超出了大小为869的轴0的范围

来自分类Dev

Java ArrayList IndexOutOfBoundsException索引:1,大小:1

来自分类Dev

Java ArrayList IndexOutOfBoundsException索引:1,大小:1

来自分类Dev

Android IndexOutOfBoundsException:索引:1,大小:1

来自分类Dev

索引错误:索引 164 超出了大小为 164 的轴 1 的范围

来自分类Dev

无法解决java.lang.IndexOutOfBoundsException:无效的索引1,大小为0

来自分类Dev

如果一个表的索引大小为1TB,则应使用多少内存

Related 相关文章

  1. 1

    Android Sqlite-异常:由于大小太大,请求索引-1,大小为32 ---?

  2. 2

    CursorIndexOutOfBoundsException:已请求索引1,大小为1。错误-Android

  3. 3

    android.database.CursorIndexOutOfBoundsException:已请求索引-1,大小为0

  4. 4

    CursorIndexOutOfBounds 异常:请求索引 0,大小为 0

  5. 5

    logcat错误索引-1请求,大小为24

  6. 6

    android.database.CursorIndexOutOfBoundsException:已请求索引133,大小为133

  7. 7

    android.database.CursorIndexOutOfBoundsException:已请求索引0,大小为0数据库错误

  8. 8

    android.database.CursorIndexOutOfBoundsException:已请求索引0,游标的大小为0

  9. 9

    Android.database.CursorIndexOutOfBoundsException:请求索引0,大小为0-s

  10. 10

    CursorIndexOutOfBoundsException:请求索引0,在INSERT / SELECT上的大小为0

  11. 11

    Error-CursorIndexOutOfBoundsException:已请求索引0,大小为0

  12. 12

    android.database.CursorIndexOutOfBoundsException:请求索引0,Android中的错误大小为0

  13. 13

    要求索引0,大小为0

  14. 14

    要求索引2,大小为2

  15. 15

    如何解决IndexOutOfBoundsException:无效的索引1,大小为1?

  16. 16

    Android-从SQLite导出到文件时,接收到“索引-1请求,大小为4”的异常

  17. 17

    JsArray <?>的大小为1,但得到“ java.lang.IndexOutOfBoundsException:索引:0,大小:0”

  18. 18

    Android java.lang.IndexOutOfBoundsException:无效的索引1,大小为1

  19. 19

    IndexError:索引1超出了轴0的范围,大小为1 / ForwardEuler

  20. 20

    java.lang.IndexOutOfBoundsException:无效的索引1,在分段RecyclerView中,大小为1

  21. 21

    Android-无效的索引1,大小为1-超出范围

  22. 22

    java.lang.IndexOutOfBoundsException:索引:1,大小:1(以数组为单位)

  23. 23

    if(data [i,1] == 1):IndexError:索引869超出了大小为869的轴0的范围

  24. 24

    Java ArrayList IndexOutOfBoundsException索引:1,大小:1

  25. 25

    Java ArrayList IndexOutOfBoundsException索引:1,大小:1

  26. 26

    Android IndexOutOfBoundsException:索引:1,大小:1

  27. 27

    索引错误:索引 164 超出了大小为 164 的轴 1 的范围

  28. 28

    无法解决java.lang.IndexOutOfBoundsException:无效的索引1,大小为0

  29. 29

    如果一个表的索引大小为1TB,则应使用多少内存

热门标签

归档