Flex: select count( id ) 使用 SQLStatement 以奇怪的方式返回结果?

发布于 2025-01-03 02:13:53 字数 702 浏览 3 评论 0原文

当我使用 Flex 执行包含某些表达式(例如“select count(id) as idCount from users”)的查询时,结果会以某种奇怪的方式出现。

结果数据数组中的第一个对象(应该存储上面查询的实际结果)具有以下“idCount = 0” 如果我尝试将其解析为属性 - 结果始终是“未定义”

sqlStatement               = new SQLStatement();
sqlStatement.sqlConnection = mainConnection;
sqlStatement.text          = 'select count( id ) as countID from Users';
sqlStatement.addEventListener( SQLEvent.RESULT, onSelectQuerySucceed );
sqlStatement.execute();


protected function onSelectQuerySucceed( event : SQLEvent ) : void
{
    var sqlResult : SQLResult = sqlStatement.getResult();
    Alert.show( sqlResult.data[ 0 ].idCount ); // <- it is undefined :|
}
  • 如何正确执行此类查询并检查结果?

When i execute a query with Flex which contain some expression like "select count(id) as idCount from users" the result is coming in some strange way.

The 1st object from the result data array ( which is supposed to store the actual result from the query above ) having the follow "idCount = 0"
if i try to parse it as property - the result is always "undefined"

sqlStatement               = new SQLStatement();
sqlStatement.sqlConnection = mainConnection;
sqlStatement.text          = 'select count( id ) as countID from Users';
sqlStatement.addEventListener( SQLEvent.RESULT, onSelectQuerySucceed );
sqlStatement.execute();


protected function onSelectQuerySucceed( event : SQLEvent ) : void
{
    var sqlResult : SQLResult = sqlStatement.getResult();
    Alert.show( sqlResult.data[ 0 ].idCount ); // <- it is undefined :|
}
  • How to properly execute such query and check the result ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

悲歌长辞 2025-01-10 02:13:53

上面的代码工作正常:|
看来是我在其他程序中的错误导致了该错误。 :|

The code above working fine :|
Seems like it was my mistake in other procedure which causing the bug. :|

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文