使用 Adobe Flash Builder 4.6
下面的代码是我用来尝试让 actionscript 从 sqlite 表中填充列表的代码。它带回了正确数量的记录,但结果显示为:[object Object] [object Object] [object Object]
有人可以告诉我我可能做错了什么吗?
private var strGetDBName:String = "CPRInstr.db";
private var strGetCurrentTableName:String = "lkStates";
import flash.data.SQLConnection;
import flash.data.SQLResult;
import flash.data.SQLStatement;
import flash.filesystem.File;
import mx.collections.ArrayCollection;
private var conn:SQLConnection;
private function init():void
{
conn = new SQLConnection();
conn.addEventListener(SQLEvent.OPEN, openSuccess);
//conn.addEventListener(SQLErrorEvent.ERROR, openFailure);
var dbFile:File = File.applicationDirectory.resolvePath(strGetDBName);
conn.openAsync(dbFile);
}
private function openSuccess(event:SQLEvent):void
{
conn.removeEventListener(SQLEvent.OPEN, openSuccess);
//conn.removeEventListener(SQLErrorEvent.ERROR, openFailure);
getData();
}
private function getData():void
{
var select:SQLStatement = new SQLStatement();
select.sqlConnection = conn;
//select.text = "SELECT id, txtState, txtAbbrev FROM " + strGetCurrentTableName;
select.text = "SELECT id, txtState FROM lkStates";
select.addEventListener(SQLEvent.RESULT, selectResult);
//select.addEventListener(SQLErrorEvent.ERROR, selectError);
select.execute();
}
private function selectResult(event:SQLEvent):void
{
var result:SQLResult = null;
result = event.currentTarget.getResult();
if(result.data)
{
list.dataProvider = new ArrayCollection(result.data);
}
}