I have a table "members" in the MySQL database.  I am
going to supply a String "editor" and search the
"members" table.  All those who are "editor" will be
picked up and their name will enter the array I want
to create.

How do I code it and return this array? 

Here is a sketch of my code.  I do not have any
confidence in my code.  I tend to creat a bean for
this ArrayList.

      EditorBean editorList = null;
      
      try 
      {
         conn = DBConnection.getDBConnection();
         stmt = conn.createStatement();
         String query = "SELECT user_name FROM members
WHERE user_role = '" + userrole + "'";   
         rs = stmt.executeQuery( query );
         if ( start >= 0 && rs.absolute( start + 1 ) )

         {
            boolean hasNext = false;
            List editors = new ArrayList();
            do
            {
               editors.add(new EditorBean(
rs.getString( user_name ) );
            } while ( ( hasNext = rs.next() ) && (
--count > 0 ) );
            editorList = new EditorBean( editors,
start, hasNext );
         }
         else
         {
            editorList = null:
         }           
         return editorList;
      }


__________________________________
Do you Yahoo!?
Free Pop-Up Blocker - Get it now
http://companion.yahoo.com/

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to