delete_crouse.java
来自「本网站为学生管理网站」· Java 代码 · 共 47 行
JAVA
47 行
package students;
import java.sql.*;
public class Delete_crouse {
public static void delete(String stu,String str1,String str2,String str3,String str4,String str5){
if(str1!=null){
fun(stu,str1);
}
if(str2!=null){
fun(stu,str2);
}
if(str3!=null){
fun(stu,str3);
}
if(str4!=null){
fun(stu,str4);
}
if(str5!=null){
fun(stu,str5);
}
}
public static void fun(String stu,String sql){
Connection con = null;
Statement stmt = null;
ResultSet rs = null;
try {
con = Database.connectToDb();
String strSQL = "delete from sel_crouses where ID='"+stu+"' and cro_id='"+sql+"'";
stmt = con.createStatement();
stmt.executeUpdate(strSQL);
} catch (SQLException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
} finally {
if (con != null) {
try {
con.close();
} catch (SQLException e) {
e.printStackTrace();
}
con = null;
}
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?