getting the values back from the Vector
2 posts in topic
Flat View  Flat View

Posted By:   Anonymous
Posted On:   Tuesday, May 29, 2007 01:14 AM

I am putting a value object in a Vector. Value object contains rows of a database table. while fetching those values back from the Vector how can i come know that this value is from particular row.
Actually i hav problem with count(*) value. I have to perform some mathematical operations on this count(*) value. But while fetching this value from vector i am unable to diffrentiate which row of the table it belongs.

Re: getting the values back from the Vector

Posted By:   rahul123  
Posted On:   Tuesday, December 17, 2013 09:45 PM

you can add whole object in to the vector 
when you will retrive the value then you can retrive simply get(index)

Re: getting the values back from the Vector

Posted By:   Tim_Frith  
Posted On:   Wednesday, May 30, 2007 04:00 PM

If you add your objects to the Vector with .add(object) then the insert order is maintained and each new item is added to the end of the list. So if you want the 1st row, do a .get(0) from the Vector (zero-based index). A .get(1) gives second row and so on.

Sounds like a Map might work better for you where the value is the database table's row and the key is the primary key value of that row.

I don't really understand the count(*) issue since you will only get one value back from a count(*) query.

Maybe you could provide more detail...

About | Sitemap | Contact