?? logindao.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 LoginDAO { private DBConnectionManager dbcm = DBConnectionManager.getInstance(); public LoginBean execute(String u_name)throws ActionException{ Connection connection=null; try { LoginBean loginBean=new LoginBean(); connection=dbcm.getConnection(); DBAccess dba=new DBAccess(connection); String sql="SELECT u_id,u_password,u_email,u_address,u_sign FROM user WHERE u_name='"+u_name+"'"; ResultSet rs=dba.openSelect(sql);//check result if (!rs.next()) return null; rs.beforeFirst(); while (rs.next()){ loginBean.setU_id(rs.getString("u_id")); loginBean.setU_name(u_name); loginBean.setU_password(rs.getString("u_password")); loginBean.setU_email(rs.getString("u_email")); loginBean.setU_address(rs.getString("u_address")); loginBean.setU_sign(rs.getString("u_sign")); } rs.close(); dba.closeSelect(); return loginBean; } 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 + -