Flex: select count( id ) 使用 SQLStatement 以奇怪的方式返回结果?
当我使用 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
上面的代码工作正常:|
看来是我在其他程序中的错误导致了该错误。 :|
The code above working fine :|
Seems like it was my mistake in other procedure which causing the bug. :|