开发者

Flex SQL Select Max

I am using the following code to get the ID of the latest form application started in my flex app, In the table the column is named id. However the following updates nothing to g.appID. The correct a开发者_Python百科pplication ID makes it's way to the row Object but not to the g.appID variable. The only property that row appears to have is Max(id) which is the correct value that I need. but when I try g.appID = row.Max(id) I get a error saying Max is not a function, so I cant get either way to work currently. Anyone see what I could be doing wrong? Thanks for any help in advance!

// Get the ID
            sqlStatement.text =
                "SELECT Max(id) FROM applications";
            sqlStatement.execute();

            var result:SQLResult;

            result = sqlStatement.getResult();
            var row:Object = result.data[0];
            g.appID = row.id;


Change your SQL to: SELECT Max(id) AS maxID FROM applications This will get you out of doing that wierd subselect your doing. This may also save you some processing depending on how often that query is running.

now change g.appID = row.id; to g.appID = row.maxID; and you should be good to go.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜