⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 select.java

📁 本网站为学生管理网站
💻 JAVA
字号:
package students;
import java.sql.*;
public class Select {
	public static void select(String stu,String str1,String str2,String str3,String str4,String str5){
		Connection con = null;
		Statement stmt = null;
		ResultSet rs = null;
		if(str1!=null){
			try {
			con = Database.connectToDb();
			String strSQL = "insert into sel_crouses(ID,cro_id,year,degree )"+"value('"+stu+"','"+str1+"','2007','')";
			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;
				}
			}
		}
		if(str2!=null){
			try {
			con = Database.connectToDb();
			String strSQL = "insert into sel_crouses(ID,cro_id,year,degree )"+"value('"+stu+"','"+str2+"','2007','')";
			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;
				}
			}
		}
		if(str3!=null){
			try {
			con = Database.connectToDb();
			String strSQL = "insert into sel_crouses(ID,cro_id,year,degree )"+"value('"+stu+"','"+str3+"','2007','')";
			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;
				}
			}
		}
		if(str4!=null){
			try {
			con = Database.connectToDb();
			String strSQL = "insert into sel_crouses(ID,cro_id,year,degree )"+"value('"+stu+"','"+str4+"','2007','')";
			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;
				}
			}
		}
		if(str5!=null){
			try {
			con = Database.connectToDb();
			String strSQL = "insert into sel_crouses(ID,cro_id,year,degree )"+"value('"+stu+"','"+str5+"','2007','')";
			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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -