SHUserDataBase.java
1004 字节
package com.dao.bksh;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import com.dao.dbutil.DataBase;
import com.vo.ShUser;
public class SHUserDataBase extends DataBase {
private static final String DB_URL = "db_bk_cxwsjh";
/**
* ��ѯ�û��������
*/
public ShUser SelectUser(String username,String password){
ShUser shuser = null;
String sql = "select * from t_shuser where a_username = ? and a_password=?";
try{
Connection conn = DataBase.getConnection(DB_URL);
PreparedStatement prep = conn.prepareStatement(sql);
prep.setString(1, username);
prep.setString(2, password);
ResultSet rs = prep.executeQuery();
if(rs.next()){
shuser = new ShUser();
shuser.setShusername(rs.getString("a_username"));
shuser.setShpassword(rs.getString("a_password"));
}
}catch(SQLException e){
e.printStackTrace();
}
return shuser;
}
}