【问题标题】:Problem in the result after doing a select in the database在数据库中进行选择后结果出现问题
【发布时间】:2011-06-29 22:20:36
【问题描述】:

我在我的 sqlite 中通过选择获得的结果有问题。

我已经有一个数据库,我正在 adobe air 中的应用程序中进行查询。在我的表格中,我有 6 列:

id | name | email | CITY_ID | state_id | phone

当我选择整个表格时,它会返回一个对象数组。

result[30].id = 30;
result [30]. name = John;
result [30]. email = john@xxx.com;
result [30]. city_id = 1352;
result [30]. state_id = 352;
result [30]. phone = xxxxxxxxx;

所有信息都正确,但 id 值不正确(正确的不是 30 )。在我看来,我得到的是数字顺序而不是 id 列值。

有人遇到过这个问题吗?

更新

我的查询是:

_selectStat = new SQLStatement();
_selectStat.addEventListener( SQLEvent.RESULT, onDataLoaded );
_selectStat.addEventListener( SQLErrorEvent.ERROR, onSqlError );
_selectStat.sqlConnection = _connection;

var sql:String = 'SELECT * FROM "main"."agencia"';

_selectStat.text = sql;
_selectStat.execute();

【问题讨论】:

  • Hy locrizak,我更新了查询。

标签: sql actionscript-3 sqlite air


【解决方案1】:

我不熟悉 Adob​​e 开发或 sqlite,所以我在这里推测。如果“id”是一个数据库属性,那么您可能需要指出您想要列“id”,而不是属性“id”。应该有一种方法可以使用 adobe 应用程序语法或 sqlite SQL 语法来做到这一点。在 mssql 中,括号 [] 用于此目的,因此 [id] 表示列 'id' 而不是属性。你的环境应该有类似的东西。

【讨论】:

  • 姓名、电子邮件、city_id ...也是列,并且这些值是正确的。我认为这不是问题。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2016-01-24
  • 1970-01-01
  • 2019-08-20
  • 2015-06-23
  • 2018-01-23
  • 2012-11-17
  • 2015-09-03
相关资源
最近更新 更多