-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathin.java
More file actions
34 lines (29 loc) · 1002 Bytes
/
in.java
File metadata and controls
34 lines (29 loc) · 1002 Bytes
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
public class In implements Command{
private String query1, query2, query3, query4, query5, query6, query7;
//get function can access user input
public void get(String input1, String input2, String input3, String input4, String input5, String input6, String input7){
query1 = input1;
query2 = input2;
query3 = input3;
query4 = input4;
query5 = input5;
query6 = input6;
query7 = input7;
}
//press function can update Database with user inputs
public void press(){
Statement statement = connection.createStatement();
String query ="SELECT "+query1+" FROM "+query2+" WHERE "+query3+" IN (SELECT "+query4+" FROM "+query5+" WHERE "+query6+"='"+query7+"');";
int replace = 0;
String s = "";
ResultSet Select_Result = statement.executeQuery(query);
while(Select_Result.next()) {
if(replace == 0) {
s += "Student_Number\n";
replace++;
}
s += Select_Result.getString("Student_Number") + "\n";
}
textLabel6.setText(s);
}
}