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

📄 carapplydbservice.java~30~

📁 车辆管理系统~其中包括了主要的增删改查的各项基本功能
💻 JAVA~30~
字号:
package bigwork.db;
import java.sql.*;

public class CarapplyDBService {
    Connection con = new DB().getConn();

    public boolean CarapplyAdd(String Appname,String AppTel,String AppTimeOut,String AppTimeIn,String Carnum,String Cartype){
        Statement stmt = null;
        String State = "审批中";
        String add = "insert into CARAPPLYDB(PERPOSER,TOUCH,INCEPTTIME,CLOSETIME,CARNNMBER,CARTYPE,ATTSTATE)values('" + Appname + "','" + AppTel +
                           "','" + AppTimeOut + "','" + AppTimeIn +
                           "','" + Carnum + "','" + Cartype + "','" + State + "')";

    ResultSet rs=null;
    try {
        if(rs==null)
            stmt = con.createStatement();
            stmt.executeQuery(add);
            return true;
    } catch (SQLException ex) {
        System.out.println(ex.getMessage());
    }
    return false;

}

public boolean CarapplyUpdate(String name){
       Statement stmt = null;
       String State = "审批通过";
       String Update = "UPDATE CARAPPLYDB SET ATTSTATE='" + State + "' WHERE PERPOSER=" + name;

   ResultSet rs=null;
   try {
       if(rs==null)
           stmt = con.createStatement();
           stmt.executeUpdate(Update);
           return true;
   } catch (SQLException ex) {
       System.out.println(ex.getMessage());
   }
   return false;

}

public String[][] CarapplySearch(){
        String[][] datas = null;
        Statement stmt = null;
        try {
            stmt = con.createStatement();

            int count = 0;
            ResultSet rs = stmt.executeQuery("select count(*) from CARAPPLYDB");
            if (rs.next()) {
                count = rs.getInt(1);
            }
            rs.close();
            datas = new String[count][];
            int i = 0;
            rs = stmt.executeQuery("select * from CARAPPLYDB");
            while (rs.next()) {
                String name = rs.getString("PERPOSER");
                String tel = rs.getString("TOUCH");
                String timeout = rs.getString("INCEPTTIME");
                String tminin = rs.getString("CLOSETIME");
                String number = rs.getString("CARNNMBER");
                String type = rs.getString("CARTYPE");
                String state = rs.getString("ATTSTATE");
                datas[i] = new String[] {name,tel,number,type,timeout,tminin,state};

                i++;
                //System.out.println(number + "," + type + "," + SIZE);
            }
            rs.close();
            stmt.close();
            con.close();

        } catch (SQLException ex) {
            ex.printStackTrace();
        }
        return datas;
}

}

⌨️ 快捷键说明

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