Novice in writing program, must be adventurousness, and must have patience, do not compromise, do not understand on the book, online search data, ask friends, resolutely carried out in the end.
Recently has been with the knowledge of the ASP in the groping forward, a run bumpy, since needless to say. Anyway
Establish a login system that requires the following purposes.
1, the user through the bean to authenticate and get the user information.
2, record user login information, such as user login times, the last logon time.
3, record the operation log.
Unresolved and puzzling questions:
1, the user login after the session can be judged by the bean.
2. Call the Oracle stored procedure through the bean and return the recordset after the select.
Operation Steps:
1. Establish user authentication Bean:
public boolean checkUser() throws Exception {
boolean flag=false;
ResultSet rs=conn.executeQuery(getSql());
if(rs.next()){
userID =rs.getString("userID");
userName =rs.getString("userName");
userPWD =rs.getString("userPWD");
userUnit =rs.getString("userUnit");
userLoadTime =rs.getDate("userLoadTime");
userLoadNumeric=rs.getInt("userLoadNumber");
flag=true;
}
rs.close();
conn.closeConn();
return flag;
}
Determines whether a user exists by the value returned.
2, record the user login information:
public void changeLoginInfo(String userID) throws Exception{
String sql="update SystemUserTable set UserLoadTime=sysdate,UserLoadNumber=UserLoadNumber+1 where userID='"+userID+"'";
conn.executeUpdate(sql);
}