-
Notifications
You must be signed in to change notification settings - Fork 0
/
search.txt
75 lines (56 loc) · 2.15 KB
/
search.txt
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
conn= MySqlConnect.ConnectDB();
String sql= "Select * from user where id=?";
try
{
pst= conn.prepareStatement(sql);
pst.setString(1,search.getText());
rs= pst.executeQuery();
if(rs.next())
{
String add1= rs.getString("fname");
firstName.setText(add1);
String add2= rs.getString("lname");
lastName.setText(add2);
String add3= rs.getString("username");
userName.setText(add3);
String add4= rs.getString("password");
password.setText(add4);
String add5= rs.getString("email");
email.setText(add5);
String add6= rs.getString("phone");
phone.setText(add6);
}
}
catch (Exception e)
{
JOptionPane.showMessageDialog(null, e);
}
conn= MySqlConnect.ConnectDB();
String sql= "Select * from `staffinq` where id=?";
try
{
pst= conn.prepareStatement(sql);
pst.setString(1,search.getText());
rs= pst.executeQuery();
if(rs.next())
{
String add1= rs.getString("id");
id.setText(add1);
String add2= rs.getString("fast_name");
fn.setText(add2);
String add3= rs.getString("last_name");
ln.setText(add3);
String add4= rs.getString("user_name");
un.setText(add4);
String add5= rs.getString("sex");
sex.setText(add5);
String add6= rs.getString("phone_number");
cn.setText(add6);
String add7= rs.getString("address");
add.setText(add7);
}
}
catch (Exception e)
{
JOptionPane.showMessageDialog(null, e);
}