📄 addadmin.java
字号:
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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -