JAVA与mysql做管理系统,修改数据时,数据写不进MySQL里,也没报错 20
//与编译语句对象Stringstrsql="updatestusetstuName=?,stuSex=?,stuAge=?,stuJG=?,stuDept=?where...
//与编译语句对象
String strsql = "update stu set stuName=?,stuSex=?,stuAge=?,stuJG=?,stuDept=? where stuId=?";
pstmt = ct.prepareStatement(strsql);
//给对象赋值
pstmt.setString(1,jf1.getText());
pstmt.setString(2,jf2.getText());
pstmt.setString(3,jf3.getText());
pstmt.setString(4,jf4.getText());
pstmt.setString(5,jf5.getText());
pstmt.setString(6,jf6.getText());
pstmt.executeUpdate();
this.dispose();//关闭学生对话框 展开
String strsql = "update stu set stuName=?,stuSex=?,stuAge=?,stuJG=?,stuDept=? where stuId=?";
pstmt = ct.prepareStatement(strsql);
//给对象赋值
pstmt.setString(1,jf1.getText());
pstmt.setString(2,jf2.getText());
pstmt.setString(3,jf3.getText());
pstmt.setString(4,jf4.getText());
pstmt.setString(5,jf5.getText());
pstmt.setString(6,jf6.getText());
pstmt.executeUpdate();
this.dispose();//关闭学生对话框 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询