如何在cordovasqlite ionic中插入和获取多个数据?

时间:2016-10-04 08:08:17

标签: sqlite ionic-framework

我想在SQLite ionic中插入并获取多个json数据,我也希望同步存储的数据。



var query ="INSERT INTO triptable(tripReqId,tripProjectCode,tripProjectName,tripTravellerName,tripStartDate,tripEndDate,tripOriginCity,tripTrNo,tripDestiCity,tripFeedBAckProvided,tripStatus) VALUES (?,?,?,?,?,?,?,?,?,?,?) ";

  angular.forEach(function(category){
       tripsdata.push(category.tripReqId);
        tripsdata.push(category.tripProjectCode);
        tripsdata.push(category.tripProjectName);
        tripsdata.push(category.tripTravellerName);
        tripsdata.push(category.tripStartDate);
       tripsdata.push(category.tripEndDate);
      tripsdata.push(category.tripOriginCity);
      tripsdata.push(category.tripTrNo);
        tripsdata.push(category.tripDestiCity);
       tripsdata.push(category.tripFeedBAckProvided);
        tripsdata.push(category.tripStatus);
      });
  $cordovaSQLite.execute(db,query,[tripsdata]).then(function(res){
    console.log("Rows are inserted"+tripData);
    }, function (err) {
                  console.log("Rows are not Inserted");
    });
  });




0 个答案:

没有答案