📄 register.java
字号:
package com.am;
import java.util.*;
import java.sql.*;
import java.text.*;
import com.am.user;
public class register extends user
{
private String strSql;
private Connection dbConn;
private int errNum;
private String errDesc;
private SimpleDateFormat dateFormatter;
public register()
{
super();
strSql="";
errNum=0;
errDesc="";
}
public void setConnection(Connection dbConn)
{
this.dbConn=dbConn;
super.setConnection(dbConn);
}
public boolean isExist()
{
strSql="select * from users ";
strSql=strSql + " where userName ='" + this.userName + "'";
try
{
Statement stmt=dbConn.createStatement();
ResultSet rs =stmt.executeQuery(strSql);
if(rs.next())
{
this.ID=rs.getLong("ID");
this.errNum=0;
this.errDesc="" ;
return true;
}
else
{
this.errNum=-1;
this.errDesc="the userID hasn't existed!!";
return false;
}
}
catch(Exception ex)
{
this.errNum=-1;
this.errDesc=ex.toString();
return true;
}
finally
{
}
}
public void addUser()
{
super.setConnection(this.dbConn);
super.add();
this.errNum=super.getErrNum() ;
this.errDesc=super.getErrDesc() ;
}
public void modifyUserInfo()
{
super.setConnection(this.dbConn);
super.update();
this.errNum=super.getErrNum() ;
this.errDesc=super.getErrDesc() ;
}
public void modifyUserPassword()
{
super.setConnection(this.dbConn);
super.update();
this.errNum=super.getErrNum() ;
this.errDesc=super.getErrDesc() ;
}
public int getErrNum()
{
return errNum;
}
public String getErrDesc()
{
return errDesc;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -