SQL 语句层返回多个值,我想用所有这些值更新 db 中的一列这里有什么问题?
String cust_code = session.getAttribute("Cust_Code").toString();
String video_typ = session.getAttribute("video_typ").toString();
int personal_p = Integer.parseInt(session.getAttribute("personal_p").toString());
int layers_p = Integer.parseInt(session.getAttribute("layers_p").toString());
String parent_cod = session.getAttribute("parent_code").toString();
Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/ontube", "root", "123456");
Statement st = con.createStatement();
String personal_po = "update customers set personal_p =personal_p + '"+personal_p+"' where membership_num='"+cust_code+"' ";
String first_layer="update customers set layers_p = layers_p+'"+layers_p+"' where membership_num='"+parent_cod+"'";
int pers_points = st.executeUpdate(personal_po);
int first_lyr = st.executeUpdate(first_layer);
String layers="select membership_num from customers where parent_num='"+parent_cod+"'" ;
// i want to update all values comes from these resultset
ResultSet rs = st.executeQuery(layers);
while(rs.next()){
String names =rs.getString(1);
String update_layers = "update customers set layers_p = layers_p + '"+layers_p+"' where membership_num='"+names+"' ";
int nms = st.executeUpdate(update_layers);