电话间隙插入查询 + 不起作用



我正在使用phoneagap框架进行APP开发。在电话间隙中插入查询:

tx.executeSql('insert into "'+gAppConfig.configTable+'" (key , value) values(uniqueId,"'+uniqueId+'"),(serverURL,"'+serverURL+'")' , querySuccess, errorQuery);

这是行不通的,谁能告诉我可能出了什么问题。谢谢。

我想你在数据库中创建了一个表,你用两列"id"和"serverURL"将其命名为"tablename";其中"id"是主键。

试试这个:

   Iquery = "INSERT INTO 'tableName' VALUES(null, "+serverURL+");";
   tx.executeSql(
      Iquery,
      null,
      function(){ /* to do on success, or you may just set it as "null" */},
      function(){ /* to do on error, or you may just set it as "null" */});

或者你可以试试这个:

 tx.executeSql("INSERT INTO tableName(id, serverURL) VALUES (?,?)",
        [null, serverURL], // these are the variables to insert
        function(){ /* to do on success, or you may just set it as "null" */},
        function(){ /* to do on fail, or you may just set it as "null" */});

您可以参考科尔多瓦的原始文档以获取更多信息。

最新更新