2

即使我尝试了这个解决方案,也试图从一周开始解决这个问题:

处理 SQL 时出错:0 PhoneGap SQL

错误消息:SQLTransactionCallback 为 null 或引发异常。

代码 :

function star(tx){
var sql = "INSERT INTO xTable (id, qid, title, answer, isman) VALUES (?,?,?,?,0)";
tx.executeSql(sql,[arr[0],arr[1],arr[2],arr[3]],done);
}

function done (tx,results){
alert (results.rows.length);
}
4

1 回答 1

0
function star(tx){
var sql = "INSERT INTO xTable (id, qid, title, answer, isman) VALUES (?,?,?,?,0)";
tx.executeSql(sql,[arr[0],arr[1],arr[2],arr[3]],done,onerror);
}

function done (tx,results){
alert (results.rows.length);
}

function onerror(error){
console.log(error);
}

尝试这个

于 2013-11-13T11:56:15.970 回答