Hello guys, I am not able to execute the Mysql query... its not takin the value of the variable 'value1'. But when i pass value like 'Bangalore' instead of value1, this query executed perfectly and the values are shown up on the datagrid. Plz help me...
CODE: <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="onCreateComplete()" layout="absolute"> <mx:VBox width="100%" height="86" y="92"> <mx:Button label="Load from Database" click="onBtnClick()"/> <mx:DataGrid id="dataGrid" width="100%" height="96" dataProvider="{users}" selectable="true"> <mx:columns> <mx:DataGridColumn dataField="train_id" headerText="Train No."/> <mx:DataGridColumn dataField="train_name" headerText="Train Name"/ > </mx:columns> </mx:DataGrid> </mx:VBox> <mx:ComboBox y="7" x="106" id="From" enabled="true"> <mx:dataProvider> <mx:Array> <mx:String>Bangalore</mx:String> </mx:Array> </mx:dataProvider> </mx:ComboBox> <mx:Script> <![CDATA[ import mx.controls.Alert; import mx.collections.ArrayCollection; import mx.controls.Alert; /** Database */ import phi.interfaces.IQuery; import phi.interfaces.IDatabase; import phi.db.Database; import phi.db.Query; /** */ private var db :IDatabase; private var query :IQuery; public var value1:String; [Bindable] public var users :ArrayCollection; /** * This will be call when Application creation * has complete. */ private function onCreateComplete():void { db = Database.getInstance(); query = new Query(); db.connect("conn1", "root", "admin", "localhost", "gis1", true); query.connect("conn1", db); } private function onBtnClick():void { value1 = To.selectedItem.toString(); query.addEventListener(Query.QUERY_END, queryEnd); query.execute("SELECT train_id,train_name FROM itenary_tbl, trainlist WHERE itenary_tbl.IT_id = trainlist.IT_id and itenary_tbl.destination = 'value1' "); } private function queryEnd(evt:Object):void { users = query.getRecords(); } ]]> </mx:Script> <mx:DateField x="225" y="7"/> <mx:ComboBox id="To" enabled="true" y="7"> <mx:dataProvider> <mx:Array> <mx:String>Chennai</mx:String> <mx:String>Mumbai</mx:String> </mx:Array> </mx:dataProvider> </mx:ComboBox> </mx:Application> --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

