0

我正在尝试使用以下 SQL 调用更新我在我的 android 应用程序中拥有的表单,但由于某种原因,它一直抛出错误。

var updateForm = "UPDATE forms SET (forms.cid, forms.barcode, forms.startTime, forms.startDate, forms.inspector, forms.model, forms.serialNo, forms.endTime, forms.address, forms.sitename, forms.unitLocation, forms.sigName) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) WHERE forms.id = ?";

function updateSingleForm() {

    var barcode = $('#barcode').val();
    var sTime = $('startTime').val();
    var sDate = $('#startDate').val();
    var inspector = $('#inspector').val();
    var model = $('#model').val();
    var serialNo = $('#serialNo').val();
    var eTime = $('#finishTime').val();
    var address = $('#address').val();
    var sitename = $('#sitename').val();
    var loc = $('#location').val();
    var signame = $('#sigName').val();
    var fid = $('#form-id').val();
    var cid = $('#client-id').val();

    var query = function query(tx) {
    tx.executeSql(updateForm, [cid, barcode, sTime, sDate, inspector, model, serialNo, eTime, address, sitename, loc, signame, fid], successDBCall2, onError)
  }

    db.transaction(query, onError3);

}

function onError3() { alert('broken here'); }

onError3似乎调用了警报,这意味着查询在某处被破坏,但我看不到问题。有人可以帮忙吗。

4

1 回答 1

2

UPDATE 语句的正确语法如下:

UPDATE forms
SET cid = ?, barcode = ?, startTime = ?, startDate = ?,
    inspector = ?, model = ?, serialNo = ?, endTime = ?,
    address = ?, sitename = ?, unitLocation = ?, sigName = ?
WHERE id = ?
于 2013-09-09T11:57:39.737 回答