wood burning stoves 2.0*
The moose likes JDBC and the fly likes How can you do this Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "How can you do this" Watch "How can you do this" New topic
Author

How can you do this

ben riches
Ranch Hand

Joined: Nov 08, 2002
Posts: 126
Hello everyone
I have an arraylist with 40 elemets inside it.
I want to be able to get the first 10 elements of the arraylist and put them into a sql statement (I can do this ok) but the problem is when i want to get the next 10 elements (from 10 to 20) they will not execute to the database. is this possible with just one prepared statement?
thanks
ben
Tina Coleman
Ranch Hand

Joined: Dec 12, 2001
Posts: 150
Should be possible with the one PreparedStatement - the whole idea of a PreparedStatement is to use it again.
Can you post what you've got so far?
ben riches
Ranch Hand

Joined: Nov 08, 2002
Posts: 126
This is my code so far i just cannot seem to set up the sql statement using one arraylist
thanks
ben

[ Edited by Dave to format code and remove smilies - hopefully this helps :roll: ]
[ January 17, 2003: Message edited by: David O'Meara ]
Jamie Robertson
Ranch Hand

Joined: Jul 09, 2001
Posts: 1879

Ben, there is way to much code and processing to hammer through. Maybe you can explain your specific problem a little more, accompanied by a code snippet(10-15 lines of code) that illustrates/identifies your specific problem. You might want to group your code up into related parts and create methods or objects out of the related code. Or you can do neither and keep waiting for a reply!
ben riches
Ranch Hand

Joined: Nov 08, 2002
Posts: 126
This is where my problem is. I want to be able to get the first 10 values from the arraylist and add them to the first column name then i want to get the next 10 values (10 to 20) and put them into a diffrent column name. but only using one preparedStatement.
thanks
ben

[ January 18, 2003: Message edited by: ben riches ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How can you do this
 
Similar Threads
setting the column names in a sql statement
extract particular elements from arraylist
arraylist in java
Jumble ArrayList
dynamic array