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

📄 adminuserdao.java

📁 一个完整的网络订餐系统
💻 JAVA
字号:
package com.systemuser.dao;

import java.sql.*;
import java.util.*;
import com.common.*;
import com.util.*;

public class AdminuserDao {

  public AdminuserDao() {
  }

  public boolean logonEsnack(String adminname, String adminpass) {
    DBConnection dbc = null;
    Connection conn = null;
    Statement stmt = null;
    ResultSet rs = null;
    boolean isTrue = false;
    String strSQL = " SELECT * FROM adminUser  where adminName='" +
        adminname + "' and adminPass='" + adminpass + "'";

    try {
      dbc = new DBConnection();
      conn = dbc.getDBConnection();
      stmt = conn.createStatement();
      rs = stmt.executeQuery(strSQL);
      if (rs.next()) {
        isTrue = true;
      }
    }
    catch (Exception exception) {
      exception.printStackTrace();
    }
    finally {
      try {
        if (rs != null)
          rs.close();
        if (stmt != null)
          stmt.close();
        if (conn != null)
          dbc.closeDBConnection(conn);
      }
      catch (SQLException e) {}
    }
    return isTrue;
  }

 //更新管理员的登录时间
  public int updateLogonDate(String adminname) {
    int nRet = 0;
    DBConnection dbc = null;
    Connection conn = null;
    Statement stmt = null;
    String strSQL = null;

    try {
      dbc = new DBConnection();
      conn = dbc.getDBConnection();
      stmt = conn.createStatement();
      strSQL = "update adminUser set lastLogindate=getdate() "+
          " where adminname='" + adminname + "'";
      nRet = stmt.executeUpdate(strSQL);
    }
    catch (Exception e) {
      nRet = -1;
      e.printStackTrace();
      System.out.println("\n" + e.toString() + "更新管理员的登录时间" + strSQL); /////错误处理!
    }
    finally {
      try {
        if (stmt != null) {
          stmt.close();
        }
        if (conn != null) {
          dbc.closeDBConnection(conn);
        }
      }
      catch (Exception ex) {}
    }
    return nRet;
  }

}

⌨️ 快捷键说明

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