📄 dialogkill.java~47~
字号:
package bookmanager;
import java.sql.Statement;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.sql.SQLException;
import java.util.Vector;
public class dialogkill {//控制类
public dialogkill() {
try {
jbInit();
} catch (Exception ex) {
ex.printStackTrace();
}
}
public void bookf(String nu)
{
Statement s;
dbconnection o = new dbconnection();
try {
s = o.getconnection().createStatement();
s.executeUpdate("delete from bookinfo where bookid='"+nu+"'");
} catch (SQLException ex) {
}
}
public Vector bookfrm()
{
Statement s;
ResultSet t;
Vector v=new Vector();
dbconnection o = new dbconnection();
try {
s = o.getconnection().createStatement();
t = s.executeQuery("select * from bookinfo where onoutctrl='是'");
while(t.next())
{
Vector vr=new Vector();
for(int i=1;i<=t.getMetaData().getColumnCount();i++)
{
vr.add(t.getString(i));
}
v.add(vr);
}
} catch (SQLException ex) {
}
return v;
}
public int drting(String rw,String b)
{
int i=0;
Statement s;
dbconnection o = new dbconnection();
try {
s = o.getconnection().createStatement();
String wer="update borrowinfo set boamount=boamount+10,moneyfee=moneyfee+"+Integer.parseInt(b)+" where borrowid='"+rw+"'";
i=s.executeUpdate(wer);
s.executeUpdate("update readinfo set readdatetime=readdatetime+100 where readid='"+rw+"'");
} catch (SQLException ex) {
}
return i;
}
public int dron(String rw,readinfo b)
{
int i=0;
Statement s;
dbconnection o = new dbconnection();
try {
s = o.getconnection().createStatement();
i=s.executeUpdate("update readinfo set readid='"+rw+"' where readid='"+b.getreadid()+"'");
s.executeUpdate("update borrowinfo set borrowid='"+rw+"' where borrowid='"+b.getreadid()+"'");
} catch (SQLException ex) {
}
return i;
}
public int deleted(readinfo p)
{
int i=0;
Statement s;
dbconnection o = new dbconnection();
try {
s = o.getconnection().createStatement();
i=s.executeUpdate("delete from readinfo where readid='"+p.getreadid()+"'");
s.executeUpdate("delete from borrowinfo where borrowid='"+p.getreadid()+"'");
} catch (SQLException ex) {
}
return i;
}
public int dele(borrowinfo u)
{
int i=0;
Statement s;
ResultSet t;
dbconnection o = new dbconnection();
try {
s = o.getconnection().createStatement();
t=s.executeQuery("select amount from borrowinfo where borrowid='"+u.getborrowid()+"'");
t.next();
i=t.getInt(1);
} catch (SQLException ex) {
}
return i;
}
public ArrayList borrowinforat()
{
Statement s1;
ResultSet t;
ArrayList fit = new ArrayList();
dbconnection u = new dbconnection();
try {
s1 = u.getconnection().createStatement();
String rr="select * from borrowinfo";
t = s1.executeQuery(rr);
System.out.println(rr);
while (t.next()) {
borrowinfo bi = new borrowinfo();
bi.setborrowid(t.getString(1));
bi.setborrowname(t.getString(2));
bi.setboamount(t.getInt(3));
bi.setamount(t.getInt(4));
bi.setmoneyfee(t.getFloat(5));
fit.add(bi);
}
} catch (SQLException ex) {
}
return fit;
}
public ArrayList bookxinxi()
{
Statement s1;
ResultSet t;
ArrayList fitk = new ArrayList();
dbconnection u = new dbconnection();
try {
s1 = u.getconnection().createStatement();
String oo="select bookid from bookinfo where onoutctrl='是'";
System.out.println(oo);
t = s1.executeQuery(oo);
while(t.next())
{
bookinfo bko=new bookinfo();
bko.setbookid(t.getString(1));
fitk.add(bko);
}
} catch (SQLException ex) {
}
return fitk;
}
public ArrayList idhao(bookinfo iobj)
{
Statement s1;
ResultSet t;
ArrayList f = new ArrayList();
dbconnection u = new dbconnection();
try {
s1 = u.getconnection().createStatement();
String oiu="select bookname,bookwhere,bookbalance from bookinfo where bookid='"+iobj.getbookid()+"'";
System.out.println(oiu);
t=s1.executeQuery(oiu);
while(t.next())
{
bookinfo bobj=new bookinfo();
bobj.setbookname(t.getString(1));
bobj.setbookwhere(t.getString(2));
bobj.setbookbalance(t.getFloat(3));
f.add(bobj);
}
} catch (SQLException ex) {
}
return f;
}
public ArrayList ymd(String strobj)
{
Statement s1;
ResultSet t;
ArrayList fit=new ArrayList();
dbconnection u = new dbconnection();
try {
s1 = u.getconnection().createStatement();
String tt="select readinfo.readdatetime from readinfo inner join borrowinfo on (readinfo.readid=borrowinfo.borrowid) where readid='"+strobj+"'";
System.out.println(tt);
t = s1.executeQuery(tt);
t.next();
int i=t.getInt(1);
System.out.println(i);
/* while(t.next())
{
readinfo a=new readinfo();
a.setreaddatetime(t.getInt(1));
}*/
} catch (SQLException ex) {
}
return fit;
}
public Vector bookxin()
{
Vector v=new Vector();
Statement s1;
ResultSet t;
dbconnection u = new dbconnection();
try {
s1 = u.getconnection().createStatement();
String oo="select bookinfo.bookid,bookinfo.bookname,bookinfo.bookautor,bookinfo.bookbalance,bookinfo.bookwhere,borrownote.notdata,borrownote.nottada "+
"from bookinfo inner join borrownote on (bookinfo.bookid=borrownote.notid) where onoutctrl='否'";
System.out.println(oo);
t = s1.executeQuery(oo);
while(t.next())
{
Vector fitk = new Vector();
for(int i=1;i<=t.getMetaData().getColumnCount();i++)
{
fitk.add(t.getString(i));
}
v.add(fitk);
System.out.println(v);
}
} catch (SQLException ex) {
}
return v;
}
private void jbInit() throws Exception {
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -