Using Flash Builder 4.6, I am following http://www.flex-blog.com/adobe-air-sqlite-example (edit: link seems to be broken) as an example, and there is one part of codes that does not work:
private function resault(e:SQLEvent):void
{
// with sqls.getResault().data we get the array of objects for each row out of our database
var data:Array = sqls.getResult().data;
// we pass the array of objects to our data provider to fill the datagrid
dp = new ArrayCollection(data);
}
Checking the program during runtime gives me that sqls.getResult() returns a valid SQLResult object, but its data is null.
And from my previous question Adobe Air: convert sqlite's result [object Object] to String?, it seems I am asking the wrong question.
Nevertheless, I've checked my SQLResult object with
trace(ObjectUtil.toString(sqls.getResult()));
and I can see that I got all of my content from sqlite:
(flash.data::SQLResult)#0
complete = true
data = (Array)#1
[0] (Object)#2
first_name = "AAA"
id = 1
last_name = "BBB"
[1] (Object)#3
first_name = "AAA"
id = 2
last_name = "BBB"
[2] (Object)#4
first_name = "qqq"
id = 3
last_name = "qqq"
lastInsertRowID = 0
rowsAffected = 0
So what's going on here? Do I really have to create my own function to parse all of my sqlite elements and then place them in the data provider myself? Yes, I can do that, but seriously, many tutorials have shown using:
var data:Array = sqls.getResult().data;
dp = new ArrayCollection(data);
Now, back on the question: What might be the possible causes of sqls.getResult().data becoming null?