Hi Ramana,

Try setting your datagrid's dataProvider property to list instead of 
loginChkA.list.

  <mx:DataGrid id="dg" dataProvider="{list}" 

Another good practice is to use mx.utils.ArrayUtil.toArray() on the 
RemoteObject result to ensure you are dealing with an array.  If the 
getList() method returns a single item, the results will be 
interpreted as an Object instead of the expected Array.

Regards,
Doug

--- In [email protected], "RAMANA" <[EMAIL PROTECTED]> 
wrote:
>
> hai everybody,
> i am new to flex environment and i am presently working on remote 
> object service.
> in this regard i need a help,
> i am trying to retrieve values from sql and output them to 
datagrid, 
> i am unable to see the values outputed to datagrid
> my sql db contains two columns cname and email, and i am working 
on 
> flex 1.5
> here is my mxml,as,java file to solve the above problem.
> 
> LoginchkAB.java
> 
> import java.sql.*; 
> import java.util.ArrayList;
> public class LoginchkAB{
> Connect       q=new Connect();    
> public void LoginchkAB()
> {
> 
> 
> }
> public ArrayList getList()
>       {
> ArrayList list = new ArrayList();
>       try
>               {
>               Connection Conn=q.establish_Connection();
>               Statement s = Conn.createStatement();
>               ResultSet rs= s.executeQuery("select cname,email 
from 
> deepa123456");
>     System.out.println("ramana");
>                       
>                                                       while 
(rs.next
> ()) {
>                                       list.add(new ViewuserVO
> (rs.getString(1),rs.getString(2)));
>       System.out.println("ramana");                           
>                                       }               
>                                       
>               s.close();              
>               Conn.close();
>               }               
>               catch(Exception e)
>               {
>               System.out.println("TechRP"+e);
>               }
>               return list;
>       }
> public static void main(String args[])
> {
> LoginchkAB q=new LoginchkAB();
>   
> }
> }
> 
> ViewuserVO.as file
> 
> class ViewuserVO {
>               public var cname : String;
>               public var email : String;
>               
> 
>       static var registered=Object.registerClass("ViewuserVO", 
> ViewuserVO);
> }
> 
> UsingRemoteObj1.mxml
> 
> <?xml version="1.0" encoding="utf-8"?>
> 
> <mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml"; 
> verticalGap="10">
>  <mx:Button label="Get user List" click="getusers()"/>
>               
> 
>  
> 
>     <mx:DataGrid id="dg" dataProvider="{loginchkA.list}" 
width="100%" 
> height="100%">
>          <mx:columns>
>             <mx:Array>
>                 <mx:DataGridColumn columnName="cname" 
> headerText="cname" />
>                 <mx:DataGridColumn columnName="email" 
> headerText="email"/>
>             </mx:Array>
>         </mx:columns>
>     </mx:DataGrid>
>     <mx:Script>
>         var list;
>                       
>     </mx:Script>
>       <mx:Script>
>               <![CDATA[
>               function getusers()
>               {
>               loginchkA.getList();                    
>               }               
>               ]]>
>               </mx:Script>
> 
>     <mx:RemoteObject id="loginchkA" result="list=event.result" 
> source="LoginchkAB" fault="alert
(event.fault.faultstring, 'Error')">
>         <mx:method name="getList"/>
>     </mx:RemoteObject>
> </mx:Application>
> 
> i would be thankful for the help regarding this.
> 
> Thank u all
> Ramana
>





--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/flexcoders/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:[EMAIL PROTECTED] 
    mailto:[EMAIL PROTECTED]

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 

Reply via email to