Hi,
I am using FLEX 3.5 SQL LITE, and code is
dbase.as
~~~~~~
var fieldarray = new Array("name","age")
datahand = new dataHand();
datahand.getData("sometable",fieldarray);
dataHand.as
~~~~~~~~~~~
public function getData(table, field){
selectStmt=new SQLStatement();
selectStmt.sqlConnection=conn;
var sql:String="SELECT ";
for(var i=0;i<field.length;i++){
var string = " "+field[i]+",";
sql+=string;
}
sql = sql.substr(0,sql.length-1);
sql+=" FROM "+table;
trace("GET DATA SQL:"+sql);
selectStmt.text=sql;
selectStmt.addEventListener(SQLEvent.RESULT, selectResult);
selectStmt.addEventListener(SQLErrorEvent.ERROR, selectError);
selectStmt.execute();
}
private function selectResult(event:SQLEvent):void {
selectStmt.removeEventListener(SQLEvent.RESULT, selectResult);
selectStmt.removeEventListener(SQLErrorEvent.ERROR, selectError);
var result:SQLResult=selectStmt.getResult();
if(result.data != null){
trace(result.data);
}else{
trace("data empty null");
}
}
but what i want is getData must be able to return the data after
successful result
like
var _data = datahand.getData("sometable",fieldarray);
where _data is data from table
is there any way to work out this, Thanks a lot.
--
You received this message because you are subscribed to the Google Groups "Flex
India Community" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/flex_india?hl=en.