📄 attendance_add_c.java
字号:
package project;
import javax.swing.JFrame;
import java.sql.*;
import javax.swing.JOptionPane;
/**
* <p>Title: </p>
*
* <p>Description: </p>
*
* <p>Copyright: Copyright (c) 2007</p>
*
* <p>Company: </p>
*
* @author not attributable
* @version 1.0
*/
//员工考勤信息
public class Attendance_add_C {
int id ;
String month = null;
int zc, cd, zt, kg;
String sql;
ResultSet rst;
public Attendance_add_C() {
}
public int confirm(Attendance_add_Model obj){
DataBase db = new DataBase();
id=obj.getId();
month=obj.getCurrmonth();
zc=obj.getZc();
cd=obj.getCd();
zt=obj.getZt();
kg=obj.getKg();
sql = "insert into attendance_table values("+ id +",'" + month + "'," + zc + "," + cd + "," + zt + "," + kg + ")";
int n = db.executeUpdate(sql);
db.close();
return n;
}
public int edit_1(Attendance_add_Model obj){//查询数据
int n=1;
DataBase db1 = new DataBase();
id=obj.getId();
month=obj.getCurrmonth();
sql ="select * from attendance_table where id="+id+" and currmonth='"+month+"'";
rst=db1.executeQuery(sql);
try {
if (rst.next()) {
obj.setZc(rst.getInt(3));
obj.setZt(rst.getInt(4));
obj.setCd(rst.getInt(5));
obj.setKg(rst.getInt(6));
}
else{
n=0;
}
}
catch (SQLException ex) {
}
db1.close();
return n;
}
public int edit_2(Attendance_add_Model obj){//修改数据
DataBase db2 = new DataBase();
id=obj.getId();
month=obj.getCurrmonth();
zc=obj.getZc();
cd=obj.getCd();
zt=obj.getZt();
kg=obj.getKg();
sql = "update attendance_table set zc="+zc+",cd="+cd+",zt="+zt+",kg="+kg+" where id="
+id+" and currmonth='"+month+"' ";
int m= db2.executeUpdate(sql);
db2.close();
return m;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -