首页 > 解决方案 > 来自 JS 的格式错误的调用:字段大小不同。在反应天真的执行更新查询时

问题描述

我只是想更新我的 SQLite 数据库中的值,在执行查询时我收到一个错误,比如

来自 js 的格式错误的调用:字段大小不同。[[10,10],[1,1],[[{"executes":[{"params":[],"sql":"BEGIN","qid":1111},{"params":[ "one",91,8181818181,37],"sql":"更新 bidinfos" 设置 customerName = ?, customerCountryCode = ? , 客户手机号码 = ? 其中 id = ?","qid":1111}],"dbargs":{"dbname":"chitNoteDataBase.db"}},5168,5169]],2583]

截屏

我试过这样:

updateOfflineBidInfoData = async (chitMemberIndex, existingCustomerDetails) => {
    debugger
    try {
        let fintechUpdateChit = {
            "customerId": existingCustomerDetails.id,
            "customerName": existingCustomerDetails.userName,
            "customerCountryCode": existingCustomerDetails.countryCode.replace("+", ""),
            "customerMobileNumber": existingCustomerDetails.mobileNumber,
        }
        alert(JSON.stringify(fintechUpdateChit))
        db.transaction((tx) => {
            tx.executeSql(
                'Update BidInfos set customerId=?, customerName=?, customerCountryCode=?, customerMobileNumber=? where id = ?',
                [Number(fintechUpdateChit.customerId), fintechUpdateChit.customerName, Number(fintechUpdateChit.customerCountryCode), Number(fintechUpdateChit.customerMobileNumber), Number(chitMemberIndex)],
                (tx, results) => {
                    // alert('Results', results.rowsAffected);
                    // results.rows.length
                    if (results.rowsAffected > 0) {
                        alert("updated")
                    } else {
                        alert('not exe')
                    }
                },
                (error) => {
                    alert(error)
                }
            );
        });
    }
    catch (error) {
        alert(error)
    }
}

请帮我弄清楚这个

标签: react-nativesqlite

解决方案


推荐阅读