代码是以Access库为例,日期对象使用的java.sql.Date()类型,因为据测试java.util.Date类型是不能添加到DateTime类型的字段中的:
import java.sql.*;
import java.text.*;
public class MSAccessDB {
public static SimpleDateFormat sd=new SimpleDateFormat("MMM dd yyyy");
private PreparedStatement pStmt=null;
private Statement stmt=null;
private Connection msConn=null;
public MSAccessDB() {
try {
jbInit();
int userID=1;
listLoginData();//列出用户信息,上次登录时间...
updateUserLogin(userID);//更新用户表中的信息,登录时间...
listLoginData();//再次显示用户信息,以便对比
}
catch(Exception e) {
e.printStackTrace();
}
}
private void listLoginData() throws SQLException {
ResultSet rs=stmt.executeQuery("select * from user_table");
伊图教程网[www.etoow.com]
http://www.etoow.com/html/2007-05/1179182920.html
while (rs.next()) {
JSP如何保存用户上次登录时间
'http://www.etoow.com/html/2007-05/1179182920.html