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