Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session

I need Data!! Please help

Avatar

Former Community Member
I have a flex1.5 application(I got it from cflex) that uses a
http service to connect to a database and return xml. I put my
results into a datagrid and everything was peachy. In trying to
take that app over to flex2.0 Beta my datagrid does not get
populated. I have an alert showing me the result of my httpservice
by saying result.childNodes.toString(). Can someone please look at
my code and see if you see something that will help. PLEASE????



<?xml version="1.0" encoding="utf-8"?>

<mx:Application xmlns:mx="
http://www.adobe.com/2006/mxml"
xmlns="*" layout="absolute">

<mx:Script><![CDATA[

import mx.controls.Alert;

[Bindable]

private var sSQL:String;



[Bindable]

private var myData:Object;



private function getData():void

{

sSQL = tiSQL.text;

var oRequest:Object = new Object();

oRequest.sql = sSQL;

var oRequestCall:Object = mxdsSQLXMLRoot.send(oRequest);

}

private function myResultHandler():void

{

myData=mxdsSQLXMLRoot.result.childNodes;

mx.controls.Alert.show(myData.toString());

}

]]></mx:Script>



<mx:HTTPService id="mxdsSQLXMLRoot"

url="
http://localhost/webservice/SQLXMLRoot.asp"

method="POST"

resultFormat="xml"

result="myResultHandler()"/>



<mx:TextArea id="tiSQL"

width="400" height="200"

text="SELECT firstname, middlename, lastname from students
FOR XML AUTO"/>

<mx:Button label="GetData" click="getData()" x="23"
y="208"/>



<mx:DataGrid id="rGrid" width="400" height="248"
dataProvider="{myData.childNodes}" x="0" y="238">

<mx:columns>

<mx:Array>

<mx:DataGridColumn dataField="firstname"
headerText="First Name"></mx:DataGridColumn>

<mx:DataGridColumn dataField="middlename"
headerText="Middle Name"></mx:DataGridColumn>

<mx:DataGridColumn dataField="lastname" headerText="Last
Name"></mx:DataGridColumn>

</mx:Array>

</mx:columns>

</mx:DataGrid>

</mx:Application>



My results look like:

<root>

<students firstname="Michael" middlename="Jeffrey"
lastname="Jordan"/>

<students firstname="George" middlename="W"
lastname="Bush"/>

</root>
0 Replies