Search code examples
sqliteactionscript-3apache-flexflex4flex3

SQL Result returns undefined value


I have a table that has a record of score.

When I query the max value of score using this:

selectStmt = new SQLStatement();
selectStmt.sqlConnection = conn;
selectStmt.text="SELECT MIN(score) FROM highscores";
selectStmt.execute();

result = selectStmt.getResult();
    var data:Object = (result.data);
    for (var i:int = 0; i < data.length; i++) 
    { 
        var row:Object = result.data[i]; 
        var output:String = "score: " + row.score;  
        trace(output);
    }

The output returns an undefined value.

How can I get the max score in the table?


Solution

  • Try selectStmt.text="SELECT MAX(score) AS maxScore FROM highscores";