addadmin.java

来自「NTsky新闻发布v1.0(提供JavaBean)」· Java 代码 · 共 58 行

JAVA
58
字号
package ntsky.admin.usr;

import java.sql.*;
import ntsky.database.*;

public class AddAdmin{
	private ResultSet rs = null;
	private int total;
	private String purview;
	//判断数据库里有无记录
	public int adminCount(){
		try{
			String sql = "select count(*) as total from admin where purview<>0;";
			DBConnect dbc = new DBConnect();
			rs = dbc.executeQuery(sql);
			rs.next();
			total = rs.getInt("total");
		}
		catch(Exception e){
			System.out.print("admincount() "+e.getMessage());
		}
		return total;
	}
	//列出数据记录
	public ResultSet rs_admin(){
		try{
			String sql = "select username,password,purview from admin where purview<>0;";
			DBConnect dbc = new DBConnect();
			rs = dbc.executeQuery(sql);
		}
		catch(Exception e){
			System.out.print("admincount() "+e.getMessage());
		}
		return rs;
	}
	//显示用户权限
	public String purview(int Ipurview){
		try{
			if(Ipurview == 1){
				purview = "管理员";
			}else
				if(Ipurview == 2){
					purview = "录入员";
				}
		}
		catch(Exception e){
			System.out.print("admincount() "+e.getMessage());
		}
		return purview;	
	}
	//关闭指针
	public void close() throws Exception{
		if(rs != null){
			rs.close();
			rs = null;
		}
	}
}

⌨️ 快捷键说明

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