0

I am trying to create a local database. I made some inserts, but when I run the code I get the "result = null" error:

var selectStmt:SQLStatement = new SQLStatement();
selectStmt.addEventListener(SQLErrorEvent.ERROR, dbErrorHandler);
selectStmt.sqlConnection = conn;
selectStmt.text = "SELECT * FROM table1";
selectStmt.execute();

var result:SQLResult = selectStmt.getResult();
var numResults:int = result.data.length;

How can I fix this?

4

1 に答える 1

0

SQLStatementは非同期であり、「flash.events.SQLEvent.RESULT」イベントリスナーでのみ「getResult()」を実行できます。

于 2012-07-07T20:09:32.780 に答える