【问题标题】:Cordova SQLite not returning rows after queryCordova SQLite 在查询后不返回行
【发布时间】:2017-11-05 11:36:12
【问题描述】:

我有一个 Cordova 应用程序,我正在使用 cordova-sqlite-storage 插件

我的查询很简单:

SELECT * FROM clients; 

这是 Javascript 代码:

  ctx.transaction(function(tx) {
        tx.executeSql("SELECT * FROM cards;", [], function(tx, rs) {
            alert(JSON.stringify(rs));
            onSuccess(rs);
        }, function(tx, error) {
            onfail();
        });
    });

rs 不包含行数据,警报显示:

{"rows":{"length":1},"rowsAffected":0}

所以我在某处有 1 行,但它没有返回它

我在这里缺少什么?

【问题讨论】:

  • 表中到底有什么?

标签: javascript android sqlite cordova cordova-plugins


【解决方案1】:

要取回数据,您需要使用 rs.rows.item(0)。fieldname

尝试警报 (rs.rows.item(0));

【讨论】:

  • 我在做 rs.rows[0] 而不是 rs.rows.item(0)
猜你喜欢
  • 2017-11-30
  • 1970-01-01
  • 2017-03-27
  • 1970-01-01
  • 2023-03-03
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多