?? producttype.java
字號(hào):
package j2eebbs;
import java.util.*;
import java.sql.ResultSet;
public class ProductType {
protected int id;
protected String Name;
protected String introduce;
public ProductType() {
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return Name;
}
public void setName(String name) {
Name = name;
}
public String getIntroduce() {
return introduce;
}
public void setIntroduce(String introduce) {
this.introduce = introduce;
}
//增加產(chǎn)品類型
public boolean insert(DB db) throws Exception {
String strSql;
strSql = "insert into producttype (name,introduce)values(" + Name + ",'" + introduce + "')";
if (db.ExecSql(strSql) == 0) {
return false;
} else {
return true;
}
}
public static Vector search(DB db) throws Exception {
Vector Types = new Vector();
ResultSet rs;
String strSql = null;
strSql = "select * from producttype ";
rs = db.OpenSql(strSql);
while (rs.next()) {
ProductType type = new ProductType();
type.setId(rs.getInt("id"));
type.setName(rs.getString("name"));
type.setIntroduce(rs.getString("introduce"));
Types.add(type);
}
return Types;
}
public static boolean delete(DB db, int id) throws Exception {
String strSql;
strSql = "delete from producttype where id=" + id;
if (db.ExecSql(strSql) == 0) {
return false;
} else {
return true;
}
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -