I have function
final public int updateSQL(Connection conn, String preparedSQL, String [] preparedValues){
int result=-1;
PreparedStatement pstmt=null;
try{
if (preparedValues!=null){
pstmt = conn.prepareStatement(preparedSQL);
for (int i=0; i<preparedValues.length; i++){
setString(pstmt,i+1,preparedValues[i]);
}
result = pstmt.executeUpdate();
}
else {
pstmt = conn.prepareStatement(preparedSQL);
result = pstmt.executeUpdate();
}
}
catch (SQLException e){debugLibrary.p("String directSQL error"+e+preparedSQL+"***");}
finally{
try{
if (pstmt!=null){
pstmt.close();
pstmt = null;
}
} catch (SQLException sqle){ }
}
return result;
}
[code]
<<<<<<<
for (int i = 0; i<library.getStringValuesLength(req, "stuid"); i++) {
String tempDate = req.getParameterValues("stuid")[i]
String[] updatei = {tempDate};
result= library.updateSQL(conn, Sql2, updatei);
}
I try to update one or a few rows, it work , I just do get why the successful update, it can return 1 or 0[code]