📄 producttype.java
字号:
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;
}
//增加产品类型
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;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -