-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCount.java
More file actions
24 lines (20 loc) · 724 Bytes
/
Count.java
File metadata and controls
24 lines (20 loc) · 724 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
public class Count implements Command{
private String query1, query2, query3, query4;
//get function can access user input
public void get(String input1, String input2, String input3, String input4){
query1 = input1;
query2 = input2;
query3 = input3;
query4 = input4;
}
//press function can update Database with user input
public void press(){
Statement statement = connection.createStatement();
String query ="SELECT COUNT("+query1+") FROM "+query2+" WHERE "+query3+" = '"+query4+"';";
ResultSet Select_Result = statement.executeQuery(query);
Select_Result.next();
int number = Select_Result.getInt(1);
String s=Integer.toString(number);
textLabel5.setText(s);
}
}