public boolean add(writeFrom frm)
{
String sql="insert into exam_write (ID_RUBRIC,TITLE,TITLE_A,TITLE_B,TITLE_C,TITLE_D,DA) values(?,?,?,?,?,?,?)";
boolean b=false;
Connection conn = ConnectionFactory.newInstance().getConnection();
if(conn == null){
return b;
}
PreparedStatement stmt = null;
try
{
stmt = conn.prepareStatement(sql);
stmt.setString(1, frm.getID_RUBRIC());
stmt.setString(2, frm.getTITLE());
stmt.setString(3, frm.getTITLE_A());
stmt.setString(4, frm.getTITLE_B());
stmt.setString(5, frm.getTITLE_C());
stmt.setString(6, frm.getTITLE_D());
stmt.setString(7, frm.getDA());
b=stmt.execute();
}catch (SQLException ex) {
ex.printStackTrace();
}
if(stmt != null){
try {
stmt.close();
} catch (SQLException ex1) {
ex1.printStackTrace();
}
stmt = null;
}
if(conn != null){
try {
conn.close();
} catch (SQLException ex2) {
ex2.printStackTrace();
}
conn = null;
}
return b;
}
{
String sql="insert into exam_write (ID_RUBRIC,TITLE,TITLE_A,TITLE_B,TITLE_C,TITLE_D,DA) values(?,?,?,?,?,?,?)";
boolean b=false;
Connection conn = ConnectionFactory.newInstance().getConnection();
if(conn == null){
return b;
}
PreparedStatement stmt = null;
try
{
stmt = conn.prepareStatement(sql);
stmt.setString(1, frm.getID_RUBRIC());
stmt.setString(2, frm.getTITLE());
stmt.setString(3, frm.getTITLE_A());
stmt.setString(4, frm.getTITLE_B());
stmt.setString(5, frm.getTITLE_C());
stmt.setString(6, frm.getTITLE_D());
stmt.setString(7, frm.getDA());
b=stmt.execute();
}catch (SQLException ex) {
ex.printStackTrace();
}
if(stmt != null){
try {
stmt.close();
} catch (SQLException ex1) {
ex1.printStackTrace();
}
stmt = null;
}
if(conn != null){
try {
conn.close();
} catch (SQLException ex2) {
ex2.printStackTrace();
}
conn = null;
}
return b;
}
加分吗!管理->分值操作->输入密码->确认 OK 呵呵