0

我想让每个名字都包含“天使”的用户。这是我的代码

this.DATABASE.transaction(tx => {
  tx.executeSql(
    "SELECT * FROM tblUser WHERE Name LIKE '%?%'",["Angel"],
    (tx, data) => {
      var result = [];
      for (let i = 0; i < data.rows.length; i++) {
        result.push(data.rows.item(i));
      }
    },
})

但我得到了错误"Cannot bind argument at index 1 because the index is out of range. The statement has 0 parameters."它只知道它什么?时候独立,不像我的查询那样理解。这个问题有什么解决办法吗?

4

1 回答 1

4

采用

"SELECT * FROM tblUser WHERE Name LIKE ?",[`%${Angel}%`]
于 2020-03-06T18:03:37.650 回答