By default, all items returned from an SQLStatement call are generic objects.
Solution
By using the itemClass property of the SQLStatement class, you can define the data type of the values returned from a SQLStatement call.
Detailed explanation
By default SQLResult returns
all of your data as generic objects. This is less than ideal, because it leaves the developer to loop over each item and convert it manually to the desired data type. AIR has the capability to
return strongly-typed values to you as well. To do this, you need to
use the itemClass property of the SQLStatement class. However, you should consider the following:
"Any class assigned to this property must have a constructor that does
not require any parameters. In addition, the class must have a single
property for each column returned by the SELECT statement. It is
considered an error if a column in the SELECT list does not have a
matching property name in the itemClass class." (excerpt from the AIR Documentation)
If your data type meets those requirements, it is as easy as just pointing the itemClass property to that class:
ActionScript:
// Import the Needed Class import vo.Conctact;... // Set the itemClass Property query.itemClass = Contact;