gpt4 book ai didi

sqlite - Flex SQLite显示SUM()结果

转载 作者:行者123 更新时间:2023-12-03 18:30:49 26 4
gpt4 key购买 nike

我尝试显示来自sqlStmt的Total sum(),但我所得到的只是[object,object],怎么知道?

谢谢

private function displayAmountHeading():void  {
sqlStmt = new SQLStatement();
sqlStmt.sqlConnection = sqlConn;
sqlStmt.text = "SELECT SUM(Amount) FROM MainTable";
sqlStmt.execute();
var result:Array = sqlStmt.getResult().data;
if (result != null) trace(result);
}

//return [object, object]

最佳答案

您正在尝试跟踪数组。如果要查看该数组中的第一个值,请尝试

SELECT SUM(Amount) as sum FROM MainTable

trace(result[0].sum);

关于sqlite - Flex SQLite显示SUM()结果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9811508/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com