📄 booktype.java
字号:
package tom.bean;
import java.sql.*;
import java.util.*;
import tom.bean.Dbconnection;
public class Booktype {
private int booktypeid;
private String booktype;
private String action;
private String condition;
private ResultSet rs;
private int rowcount;
private String message;
private int id;
public Booktype() {
booktypeid=0;
booktype=null;
message=null;
}
//
public void setAction(String s)
{
action=s;
}
//
public void setBooktypeid(int n)
{
booktypeid=n;
}
public int getBooktypeid()
{
return booktypeid;
}
//
public void setBooktype(String s)
{
booktype=s;
}
public String getBooktype()
{
return booktype;
}
//
public void setId(int n)
{
id=n;
}
public int getId()
{
return id;
}
public String getMessage()
{
return message;
}
//
public int getRowcount()
{
return rowcount;
}
//
public ResultSet booktypelist()
{
condition="SELECT * from booktype order by booktypeid";
Dbconnection e=new Dbconnection();
e.condb();
rs=e.select(condition);
rowcount=e.getRowcount();
message=e.getMessage();
return rs;
}
//
public void selectspec()
{
condition="SELECT * from booktype where booktypeid="+booktypeid;
Dbconnection e=new Dbconnection();
e.condb();
rs=e.select(condition);
try{
rs.next();
booktypeid=rs.getInt(1);
booktype=rs.getString(2);
}
catch(SQLException f){message="error";}
}
public void ManageBooktype()
{
if(action.equals("add"))
condition="INSERT INTO booktype VALUES"+"("+booktypeid+","+"'"+booktype+"')";
if(action.equals("edit"))
condition="update booktype set booktypeid="+booktypeid+",booktype='"+booktype+"' where booktypeid="+id;
if(action.equals("delete"))
condition="DELETE FROM booktype WHERE booktypeid="+booktypeid;
Dbconnection e=new Dbconnection();
e.condb();
e.update(condition);
message=e.getMessage();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -