View Single Post
Join Date: Mar 2006
Posts: 20
Reputation: muthumari is an unknown quantity at this point 
Solved Threads: 0
muthumari muthumari is offline Offline
Newbie Poster

Re: inserting multiple selection from checkbox in to one column

 
0
  #5
Mar 30th, 2006
Originally Posted by masijade
No What I meant was using the JDBC prepared statement. here an example:

  1. String[] vals = request.getParameterValues("checkbox");
  2. try {
  3. PreparedStatement pStmt = conn.prepareStatement("Insert into table (field) values (?)");
  4. for (String val : vals) {
  5. pStmt.setString(1, val);
  6. pStmt.execute();
  7. }
  8. } catch .....

of course replacing checkbox, table, and field with the real things.


Hi i have one error in this line:

pStmt.setString(1, val);


The error is ; expected.
I haven't any idea about this

Can you help me
Reply With Quote