ssummeraw 2013-06-08 05:07 采纳率: 10%
浏览 3617

在 index 4 的 bind value 是 null

我使用的下面的代码,但是给出错误

String updateQuery ="INSERT INTO MAAccounts(userId, accountId, accountType, accountName, parentAccountId, currencyCode, isTransactionDefaultStatusOpen, currentBalance, monthlyBudget, createdOn, updatedOn) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; 
        String[] valVars = { 
                stringToDB(account.userId),
                integerToDB(account.accountId).toString(),
                integerToDB(account.accountType.getValue()).toString(),
                stringToDB(account.accountName),
                (integerToDB(account.parentAccountId) != null ? integerToDB(account.parentAccountId).toString() : null),
                stringToDB(account.currencyCode),
                boolToDB(account.isTransactionDefaultStatusOpen).toString(),
                CurrencyToDB(account.currentBalance).toString(),
                CurrencyToDB(account.monthlyBudget).toString(),
                dateToDB(now),
                "false"};

        Cursor c = mDb.rawQuery(updateQuery, valVars);

错误:java.lang.IllegalArgumentException: the bind value at index 4 is null

请问如何解释这个错误?

  • 写回答

1条回答 默认 最新

  • 北边的世界 2013-06-08 10:51
    关注

    这个错误的意思是你sql语句中绑定的第四个值是空的。(integerToDB(account.parentAccountId) != null ? integerToDB(account.parentAccountId).toString() : null),
    这个判断语句中可能返回了一个null,因此报错。

    评论

报告相同问题?

悬赏问题

  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作