hai,
I am new to flex environment and i am struck up with a prob.
I am trying to access my database to retrieve two of the values in it 
depending on the primary key( that user inputs).
i want to build a column chart using both of those values,,
 

here is my mxml file

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml";>


<mx:Script>
<![CDATA[
var userList=0;

function initApp()
{
//alert("Hello World!!");
}      
                function log()
                {
                users.getValid(userid.text);                    
                }
                
                
]]>
</mx:Script>
<mx:Canvas width="236" height="400">
      <mx:Button x="80" y="203" id="Register" label="Get Result" 
click="log()" textAlign="center" />          


  <mx:TextInput id="userid" x="31" y="142"/>
  <mx:Label x="81" y="102"  text="Enter User-Id" height="20" 
width="88" />
</mx:Canvas>
 <mx:Model id="results" source="users.getValid.result"/>

    <mx:ColumnChart width="100%" height="100%" 
dataProvider="{userlist}" showDataTips="true">

        <mx:horizontalAxis>
            <mx:CategoryAxis dataProvider="{results}" 
categoryField="results.examid"/>
        </mx:horizontalAxis>

        <mx:series>
            <mx:Array>
                <mx:ColumnSeries yField="results.score"/>
            </mx:Array>
        </mx:series>

    </mx:ColumnChart>
<!--Login checking remote object-->
  
        <mx:RemoteObject id="users" source="report" 
result="userList=event.result" fault="alert
(event.fault.faultstring, 'Error')" >
           <mx:method name="getValid"></mx:method>         
    </mx:RemoteObject>
        
</mx:Application>


my java file to retrive the values

import java.sql.*; 
import java.util.ArrayList;

public class report {
        
        
        
        Connect q=new Connect();
        public report(){
        }
        
        
         
    
        public ArrayList getValid(int num){
        ArrayList list1 = new ArrayList();
                try{
                        Connection Conn=q.establish_Connection();
        
                        Statement s = Conn.createStatement();
                        ResultSet rs=s.executeQuery("select 
examid,score from report where userid="+num);
                        while (rs.next()) {
                                                
                                        list1.add(new getreportlistVO
( rs.getInt(1),rs.getInt(2)));
                                                
                                                                }
                        s.close();
                        Conn.close();   
                        


                }
                catch(Exception e)
                {
                        System.out.println("TechRP Error : "+e);
                }
                return list1;
                
        }
public static void main(String Args[])
{
report q=new report();
        
}
}
        
my VO file to pick up the values to DB

import java.util.Random;
import java.io.*;
import java.sql.*;
public class getreportlistVO implements java.io.Serializable
{
int examid,score;

        
  public void setexamid(int eid) {
            this.examid = eid;
   
    }

    public int getscore() {
        return score;
    }

    public void setscore(int score) {
        this.score = score;
    }
 

    public  getreportlistVO(int examid, int score)
         {
                this.examid=examid;
        this.score=score;        
    }
    
    public void printval()
    {
            System.out.println(examid);
            System.out.println(score);
            }       
}


Please help me friends

Deepa Pathuri


Reply via email to