我正在尝试使用以下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
中的警报似乎被调用,这意味着查询在某处被破坏但我看不到问题。有人可以帮忙。
答案 0 :(得分:2)
correct syntax for an UPDATE statement是这样的:
UPDATE forms
SET cid = ?, barcode = ?, startTime = ?, startDate = ?,
inspector = ?, model = ?, serialNo = ?, endTime = ?,
address = ?, sitename = ?, unitLocation = ?, sigName = ?
WHERE id = ?