-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUSORDAOSImpl.java
More file actions
53 lines (47 loc) · 1.37 KB
/
USORDAOSImpl.java
File metadata and controls
53 lines (47 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package DAOImpl;
import java.sql.Connection;
import java.sql.Date;
import java.sql.PreparedStatement;
import Class.USOR;
import DAO.USORDAO;
import DAOBase.DAOBase;
public class USORDAOSImpl extends DAOBase implements USORDAO{
private static final String CREATE_USOR_SQL = "insert into USOR values(?,?,?)";
private static final String DELETE_USOR_SQL = "delete from CM where CMNO = ? AND UNO = ?";
@Override
public void insertUSOR(USOR usor) {
// TODO Auto-generated method stub
Connection conn = null;
PreparedStatement pstmt = null;
try {
conn = getConnection();
pstmt = conn.prepareStatement(CREATE_USOR_SQL);
pstmt.setInt(1,usor.getCMNO());
pstmt.setInt(2, usor.getUNO());
pstmt.setInt(3, usor.getUSO());
pstmt.executeUpdate();
pstmt.close();
conn.close();
}catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
@Override
public void deleteUSOR(int cmid, int uid) {
// TODO Auto-generated method stub
try {
Connection conn = getConnection();
PreparedStatement pstmt = conn.prepareStatement(DELETE_USOR_SQL);
pstmt.setInt(1, cmid);
pstmt.setInt(2, uid);
pstmt.executeUpdate();
System.out.println("ɾ³ý³É¹¦£¡");
pstmt.close();
conn.close();
}catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}