YLDUserDataBase.java 1.0 KB
package com.dao.bkyld;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

import com.dao.dbutil.DataBase;
import com.vo.YldUser;

public class YLDUserDataBase extends DataBase  {

	private static final String DB_URL = "db_yld";
	/**
	 * ��ѯ�û��������
	 */
	public YldUser SelectUser(String username,String password){

		YldUser  ylduser = null;
		String sql = "select * from t_ylduser 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()){
			ylduser = new YldUser();
			ylduser.setYldusername(rs.getString("a_username"));
			ylduser.setYldpasswprd(rs.getString("a_password"));
			}
			
			
		}catch(SQLException e){
			e.printStackTrace();
		}
		return ylduser;
	}
	
}