Hi Joseph

You can check the following link

http://www.java2s.com/Code/Java/Collections-Data-Structure/Storeuserdefinedobjectsinarraylist.htm

Thanks
Pankaj Jain

On Mon, Aug 27, 2012 at 6:22 PM, Joseph John <[email protected]> wrote:

> Thanks Pankaj
>   Can I get a link for an example of this get and setter method way of
> using
> thanks
>
>
>
> On Mon, Aug 27, 2012 at 4:31 PM, Pankaj Jain <[email protected]> wrote:
>
>> Hello Joseph
>>
>> The better option is, create a POJO class with all the fields of database
>> that you want, create getters and setters of the fields and make a List of
>> this class. This way it will be easy to manage the data.
>>
>> Thanks
>> Pankaj Jain
>>
>>
>> On Mon, Aug 27, 2012 at 5:48 PM, Joseph John <[email protected]> wrote:
>>
>>> I am trying out this options now
>>>   lsm.add(rs.getString(1) + ","+ rs.getString(2)+ "," + rs.getString(3)
>>> + "," + rs.getString(4)+ "," + rs.getString(5));
>>>
>>> On Monday, August 27, 2012 4:02:26 PM UTC+4, Joseph John wrote:
>>>>
>>>> Hi All
>>>> I am a novice, just trying out
>>>> I am trying to read all the values of the table to an array
>>>> I am using the code
>>>> " Statement stat = (Statement) conn.createStatement();
>>>>                 String SQLstring = "select * from students ";
>>>>                 ResultSet rs = (ResultSet) stat.executeQuery(SQLstring);
>>>>              List lsm = new ArrayList();
>>>>              while (rs.next()) {
>>>>
>>>>                  lsm.add(rs.getString(1));
>>>>
>>>> This way, I get only the first field value in my ArrayList "lsm", how
>>>> could I add the other values such as rs.getString(2), rs.getString(3) to
>>>> my arrayList 'lsm
>>>> Guidance requested
>>>> Thanks
>>>> Joseph John
>>>>
>>>>  --
>>> You received this message because you are subscribed to the Google
>>> Groups "JPassion.com: Web Programming Basics" group.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msg/jpassion_web/-/aF-zd6iJRd0J.
>>> To post to this group, send email to [email protected].
>>> To unsubscribe from this group, send email to
>>> [email protected].
>>> For more options, visit this group at
>>> http://groups.google.com/group/jpassion_web?hl=en.
>>>
>>
>>
>
>
> --
> Thanks
> Joseph John
> http://www.meetup.com/EmiratesLoCo/
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"JPassion.com: Web Programming Basics" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/jpassion_web?hl=en.

Reply via email to