?? employee.java
字號:
package good;
import java.sql.ResultSet;
import java.util.Vector;
public class Employee {
/**
* @param args
*/
private String employeeId;
private String employeeName;
private String employeeNumber;
//private String goodPrice;
public String getEmployeeId() {
return employeeId;
}
public void setEmployeeId(String employeeId) {
this.employeeId = employeeId;
}
public String getEmployeeName() {
return employeeName;
}
public void setEmployeeName(String employeeName) {
this.employeeName = employeeName;
}
public String getEmployeeNumber() {
return employeeNumber;
}
public void setEmployeeNumber(String employeeNumber) {
this.employeeNumber = employeeNumber;
}
public boolean employeeAdd()
{
DataConn storCon = new DataConn();
String addSql = null;
storCon.dataConnDerectForMySql();
addSql="Insert into employee(employeeId,employeeName,employeeNumber) values("+employeeId
+",'"+employeeName+"','"+employeeNumber+"')";
storCon.executeDerectUpdate(addSql);
return true;
}
public boolean employeeModi()
{
DataConn storCon = new DataConn();
String addSql = null;
storCon.dataConnDerectForMySql();
addSql="update employee set employeeName='"+employeeName+"',"+
"employeeNumber='"+employeeNumber+"'where employeeId="+employeeId;
storCon.executeDerectUpdate(addSql);
return true;
}
public Vector GetAllemployeeId() {
String quy;
String temp;
int i = 0;
DataConn storCon = new DataConn();
Vector list = new Vector();
storCon.dataConnDerectForMySql();
ResultSet rs = null;
quy = "select employeeId from employee order by employeeId";
try {
rs = storCon.executeDerectQuery(quy);
while (rs.next()) {
temp=rs.getString(1);
System.out.println(temp);
list.add(temp==null? "":temp.trim());
}
} catch (Exception e) {
e.printStackTrace();
}
return list;
}
public void resultData() {
String quy;
DataConn storCon = new DataConn();
String addSql = null;
ResultSet rs = null;
storCon.dataConnDerectForMySql();
quy = "select * from employee where employeeId=" + this.getEmployeeId() ;
try {
rs = storCon.executeDerectQuery(quy);
if (rs.next()) {
this.setEmployeeName(rs.getString("EmployeeName"));
this.setEmployeeNumber(rs.getString("EmployeeNumber"));
//this.setGoodPrice(rs.getString("GoodPrice"));
} else {
}
rs.close();
} catch (Exception e) {
e.printStackTrace();
}
}
private void employeeName(String string) {
// TODO Auto-generated method stub
}
public boolean checkExist(String id) {
String quy;
DataConn storCon = new DataConn();
ResultSet rs = null;
storCon.dataConnDerectForMySql();
quy = "select * from employee where employeeId=" + id ;
try {
rs = storCon.executeDerectQuery(quy);
if (rs.next()) {
return false;
} else {
return true;
}
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
public boolean checkData()
{String quy;
DataConn storCon = new DataConn();
ResultSet rs = null;
storCon.dataConnDerectForMySql();
quy = "select * from employee where employeeId="+ this.getEmployeeId() ;
try {
rs = storCon.executeDerectQuery(quy);
if (rs.next()) {
return false;
} else {
return true;
}
} catch (Exception e) {
e.printStackTrace();
return false;
}
}}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -