I am in the process of learning my way around cordova, I am using visual studio and am slight confused with how to code an insert function for adding multiple records to a sqlite database. I can do this for a single record with no problems however when i try to do this for multiple records things go slightly astray.
i had this code which i know isnt great but as i said i am learning so try to build on what i have learnt to find the right soltion.
 $.ajax({
    type: "post",
    url: baseURI
}).then(function (r) {
    var items = [];
    var db = window.openDatabase("BlissData", "1.0", "Bliss Data", 200000);
    $.each(r.aaData, function (line) {
        localStorage.customerid = r.aaData[line].Customerid;
        localStorage.customername = r.aaData[line].CustomerName;
        localStorage.address1 = r.aaData[line].siteAddress1;
        localStorage.address2 = r.aaData[line].siteAddress2;
        localStorage.address3 = r.aaData[line].siteAddress3;
        localStorage.address4 = r.aaData[line].siteAddress4;
        localStorage.mobile = r.aaData[line].mobilephone;
        localStorage.telephone = r.aaData[line].Telephone;
        localStorage.email = r.aaData[line].Email;
        db.transaction(insertCustomers, errorCB);
    });
});
function insertCustomers(tx) {
tx.executeSql('INSERT INTO BlissCustomers (CustomerId,CustomerName,Address1,Address2,Address3,Address4,Telephone,Mobile,Email) VALUES ("' + localStorage.customerid + '","' + localStorage.customername + '","' + localStorage.address1 + '","' + localStorage.address2 + '","' + localStorage.address3 + '","' + localStorage.address4 + '","' + localStorage.mobile + '","' + localStorage.telephone + '","' + localStorage.email + '")',[],nullHandler,errorHandler);
}
when this executes i get 10 rows added to the table but all rows have the same data. SO i guess there is an understanding issue here!
So then i found a different example which looks like a better solution. However this returns an error - Uncaught ReferenceError: dbExecution is not defined
db.transaction(function (tx) {
        $.each(r.aaData, function (line) {
            dbExecution.databaseVar.transaction(function (tx) {
                tx.executeSql("INSERT INTO BlissCustomers (CustomerId,CustomerName,Address1,Address2,Address3,Address4,Telephone,Mobile,Email) VALUES (?,?)", [r.aaData[line].Customerid, r.aaData[line].CustomerName, r.aaData[line].siteAddress1, r.aaData[line].siteAddress2, r.aaData[line].siteAddress3, r.aaData[line].siteAddress4, r.aaData[line].mobilephone, r.aaData[line].telephone, r.aaData[line].email]);
            });
        }, error, success);
    });
Is there a simple tutorial anywhere that i can read to understand what I'm doing wrong or can anyone point me in the right direction here?
 
     
    