javaEE课程设计(13)
时间:2025-07-07
时间:2025-07-07
桂林电子科技大学 计算机与工程学院 信息管理与信息系统 JavaEE 课程设计 报告
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
conn = DriverManager.getConnection("jdbc:sqlserver://localhost:1433;" + " DatabaseName=MyHospital", "root", "123");
stmt = conn.createStatement();
String sql = "delete from DoctorImfomation where Name='" + name + "'"; java.sql.PreparedStatement psmt = conn.prepareStatement(sql); //psmt.setString(1, );
int rowCount = psmt.executeUpdate();
if (rowCount > 0) {
deleteflag = true;
}
Patient JavaBen的修改功能
try {
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
conn = DriverManager.getConnection("jdbc:sqlserver://localhost:1433;" + " DatabaseName=MyHospital", "root", "123");
stmt = conn.createStatement();
String sql = "update DoctorImfomation No=?,Major=?,Introduction=?,WorkTime=?,Telephone=? where Name=?";
//+where Name='" + Name + "'";
java.sql.PreparedStatement psmt = conn.prepareStatement(sql); //psmt.setString(1, );
psmt.setString(1, this.no);
psmt.setString(2, this.major);
psmt.setString(3, this.introduction);
psmt.setString(4, this.workTime);
psmt.setString(5, this.telephone);
psmt.setString(6, );
int rowCount = psmt.executeUpdate();
if (rowCount > 0) {
alterflag = true;
}
set
上一篇:作业(工艺)文件汇编