SQLite query - empty results

Hello,
I have this code in a form called “ContractList”:

    ContractList.onshow=function(){
    //load the list group from sql lite
    //query sqlite for the active contracts
    DB = SqlOpenDatabase("pts.db3");
    s=new Array(["SELECT id, contract_name FROM contract;" , resultHandler]);
    DBRecords=[];
    NSB.WaitCursor(true);
    Sql(DB, s);
  
    }

During runtime I query a remote database API with AJAX and get 1 record which I promptly write to a SQLite database. I can see the record in the table using Chrome dev tools.
The above function is not returning a row and I am not sure why.

Here is the console contents…

SQLResultSet {rows: SQLResultSetRowList, rowsAffected: 0}
1. insertId: (...)
2. rows: SQLResultSetRowList {length: 0}
3. rowsAffected: 0
4. __proto__: SQLResultSet`

Any thoughts?

Hi,
Can you please also show the code in the „resultHandler“ function, and I suggest you also add an errorHandler function.
Only there you can determine if any record was returned.
Thomas

Here is the handler

   function resultHandler(transaction, results) {
   console.log(results);
   //Called On completion of Sql command in ContractList.onshow
   DBRecords = results;
   NSB.WaitCursor(false);
  
  //Clear grid before reading Next group of records
  listContracts.clear();
  iRec=0;
  var dbRec = DBRecords.rows.length;
  for (i=0; i <= dbRec -1; i++) { 
      var c = DBRecords.rows.item(iRec)["contract_name"];
      alert(c);
      listContracts.additem(c);
      //id = DBRecords.rows.item(iRec)["id"];
      //$("#listContracts_" & Cstr(iRec)).data("id", id);
      iRec = iRec + 1;
  }
  
}