With a prepared statement and multiple executes.
masijade
Industrious Poster
4,253 posts since Feb 2006
Reputation Points: 1,471
Solved Threads: 494
No What I meant was using the JDBC prepared statement. here an example:
String[] vals = request.getParameterValues("checkbox");
try {
PreparedStatement pStmt = conn.prepareStatement("Insert into table (field) values (?)");
for (String val : vals) {
pStmt.setString(1, val);
pStmt.execute();
}
} catch .....
of course replacing checkbox, table, and field with the real things.
masijade
Industrious Poster
4,253 posts since Feb 2006
Reputation Points: 1,471
Solved Threads: 494
Are you using jdk 1.5 or an earlier version. If you are not using 1.5 then the following lines
must be changed:
for (String val : vals) {
pStmt.setString(1, val);
pStmt.execute();
to:
for (int i = 0; i < vals.length; i++) {
pStmt.setString(1, vals[i]);
pStmt.execute();
masijade
Industrious Poster
4,253 posts since Feb 2006
Reputation Points: 1,471
Solved Threads: 494
multiple checkbox & textfield insert in Oracle9i using Jsp
It is bad enough that you reopened old thread you did not even provided proper description of whatever you up to. Do you mind to correct your mistake?
peter_budo
Code tags enforcer
15,436 posts since Dec 2004
Reputation Points: 2,806
Solved Threads: 902