⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dialogkill.java~54~

📁 此程序是用Java实现的一个图书管理系统,再加以可以做毕业设计用而,而且实现的工能相对效全.
💻 JAVA~54~
字号:
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 {//控制类
     Statement s;
       ResultSet t;
     dbconnection o = new dbconnection();
    public dialogkill() {
        try {
            jbInit();
            s = o.getconnection().createStatement();
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }
    public int bookinfoupdate(String str1,String str2,String str3,String str4,String str5,String str6,String str7,String str8,String str9)
    {
        int i=0;
        try {
           i= s.executeUpdate("update bookinfo set bookname='"+str2+"',bookautor='"+str3+"',bookbalance="+
                    Float.parseFloat(str4)+",bookwhere='"+str5+"',booktime='"+str6+"',outtime='"+
                    str7+"',onoutctrl='"+str8+"',booknotes="+Integer.parseInt(str9)+" where bookid='"+str1+"'");
        } catch (SQLException ex) {
        }
        return i;
    }
    public void bookf(String nu)
    {
        try {
           s.executeUpdate("delete from bookinfo where bookid='"+nu+"'");
        } catch (SQLException ex) {
        }
    }
    public Vector bookfrm()
    {
        Vector v=new Vector();
        try {
            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;
       try {
           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;
        try {
            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;
        try {
            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;
        try {
            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()
  {
      ArrayList fit = new ArrayList();
      try {
          String rr="select * from borrowinfo";
          t = s.executeQuery(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()
  {
      ArrayList fitk = new ArrayList();
    try {
        String oo="select bookid from bookinfo where onoutctrl='是'";
        t = s.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)
  {
      ArrayList f = new ArrayList();
    try {
                String oiu="select * from bookinfo where bookid='"+iobj.getbookid()+"'";
                 t=s.executeQuery(oiu);
        while(t.next())
        {
            bookinfo bobj=new bookinfo();
            bobj.setbookid(t.getString(1));
            bobj.setbookname(t.getString(2));
            bobj.setbookautor(t.getString(3));
            bobj.setbookbalance(t.getFloat(4));
             bobj.setbookwhere(t.getString(5));
             bobj.setbooktime(t.getString(6));
             bobj.setouttime(t.getString(7));
             bobj.setbooknotes(t.getInt(9));
            f.add(bobj);
        }
    } catch (SQLException ex) {
    }
    return f;
  }
  public int ymd(String strobj)
  {
      int fit=0;
    try {
        String tt="select readinfo.readdatetime from readinfo inner join borrowinfo "+
                  "on (readinfo.readid=borrowinfo.borrowid) where readid='"+strobj+"'";
        t = s.executeQuery(tt);
        t.next();
        fit=t.getInt(1);
    } catch (SQLException ex) {
    }
    return fit;
  }
  public Vector bookxin()
  {
      Vector v=new Vector();
    try {
        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='否'";
        t = s.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);
        }
    } catch (SQLException ex) {
    }
    return v;
  }
    private void jbInit() throws Exception {
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -