Ios Phonegap插入查询+;不起作用

Ios Phonegap插入查询+;不起作用,ios,sqlite,cordova,Ios,Sqlite,Cordova,我正在使用phoneagap框架进行应用程序开发。 在phonegap中插入查询: tx.executeSql('insert into "'+gAppConfig.configTable+'" (key , value) values(uniqueId,"'+uniqueId+'"),(serverURL,"'+serverURL+'")' , querySuccess, errorQuery); 这不起作用,有人能告诉我哪里出了问题吗。谢谢。我想您已经在数据库中创建了一个表,并用两列“id

我正在使用phoneagap框架进行应用程序开发。 在phonegap中插入查询:

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" */});
更多信息,请参阅原件