This week's book giveaway is in the General Computing forum.
We're giving away four copies of Learning Regular Expressions and have Ben Forta on-line!
See this thread for details.
Win a copy of Learning Regular Expressions this week in the General Computing forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

To store multiple data in ResultSet  RSS feed

Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI All,

Can any body help me to say what is process to store multiple data with ResultSet.

I want to write a code that shows multiple rows, selected by the previous jsp page, but i'm fail. It shows only one row in current page whether i select multiple rows in previous page.

My code is following: -

<% PreparedStatement ps=null;
Connection con=null;
ResultSet rs=null;
int m=0;
String[] kys= request.getParameterValues("pkey");

ps=con.prepareStatement("SELECT distinct a.vendor_id,a.vendor_name,b.pan_no FROM po_vendors a,JA_IN_VENDOR_TDS_INFO_HDR b "+
"WHERE a.vendor_id=b.vendor_id and a.vendor_id=?");
for(int i=0;i<kys.length;i++)


<td><input type=checkbox name=pkey value="<%= rs.getString(1) %>" /> </td>
<td><%= rs.getString(2) %> </td>
<td><%= rs.getString(3) %> </td>
<td><input type=text name=s_name value="" > </td>
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your code is looping through the form parameters but it's writing them all to the same statement parameter.

Each iteration is writing to the statement's "1" parameter.
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!