2012-02-04 36 views
0

當我執行一個包含一些表達式的查詢,如「select count(id)as idCount from users」時,結果以一種奇怪的方式出現。Flex:select count(id)以奇怪的方式返回結果與SQLStatement?

如果我嘗試將其解析爲屬性,結果始終爲「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 :| 
} 
  • 如何正確地執行這樣的查詢和檢查結果?
+1

你能詳細說一下嗎?您是否使用ActionScript SQLLite API?如果不;你如何執行查詢? – JeffryHouser 2012-02-04 20:56:20

+0

是的。我正在使用SQLLite API。 – 2012-02-04 21:09:27

+0

我已經添加了我正在執行的代碼。我希望這有助於解決問題:| – 2012-02-04 22:10:28

回答

0

上面的代碼工作正常: 似乎這是我在其他程序中導致錯誤的錯誤。 :|

+0

至少我希望代碼可以幫助別人尋找某種解決方案。 – 2012-02-04 22:47:16