YLDUserDataBase.java
1.0 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
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;
}
}