📄 userdao.java
字号:
/*******************************************************************\* ** LightningBoard ** ** http://sourceforge.net/projects/lightningboard/ ** ** Copyright (c) 2002 Xiaobo Liu ** *********************************************************************** LICENSE INFORMATION ** ** LightningBoard is free software; you can redistribute it and/or ** modify it under the terms of the GNU General Public License as ** published by the Free Software Foundation; either version 2 of ** the License, or any later version. ** ** We don't charge anything for the use of LightningBoard, we only ** require you to keep the copyright present on your site and in ** the source files. ** ** LightningBoard is distributed in the hope that it will be useful,** but without any warranty; without even the implied warranty of ** merchantability or fitness for a particular purpose. See the GNU ** General Public License for more details. ** *\*******************************************************************/package liuxiaobo.lb.dao;import java.sql.*;import java.util.*;import liuxiaobo.db.*;import liuxiaobo.lb.*;import liuxiaobo.lb.bean.*;public class UserDAO { private DBConnectionManager dbcm = DBConnectionManager.getInstance(); public UserBean execute(int u_id)throws ActionException{ Connection connection=null; try { UserBean userBean=new UserBean(); connection=dbcm.getConnection(); DBAccess dba=new DBAccess(connection); String sql="SELECT u_name,u_email,u_regtime,u_address,u_sign,u_post,u_lasttime,u_lastip FROM user WHERE u_id=" + u_id; ResultSet rs=dba.openSelect(sql);//check result if (!rs.next()) return null; rs.beforeFirst(); while (rs.next()){ userBean.setU_id(String.valueOf(u_id)); userBean.setU_name(rs.getString("u_name")); userBean.setU_email(rs.getString("u_email")); userBean.setU_regtime(rs.getString("u_regtime")); userBean.setU_address(rs.getString("u_address")); userBean.setU_sign(rs.getString("u_sign")); userBean.setU_post(rs.getString("u_post")); userBean.setU_lasttime(rs.getString("u_lasttime")); userBean.setU_lastip(rs.getString("u_lastip")); } rs.close(); dba.closeSelect(); return userBean; } catch (Exception ex) { throw new ActionException(ex); }finally{ try { dbcm.freeConnection(connection); } catch (SQLException ex) { // } } }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -