I'm not sure how to write it in a way the query will take all the values stored in the excludeRooms
and use it in the query then add the results to the tableRoomsData
vector
Code:
List<String> excludeRooms = new ArrayList<String>();
Vector<String> tableRoomsData = new Vector<String>();
m.dbConnect();
PreparedStatement stmt = m.getCon().prepareStatement("SELECT * FROM room_view
WHERE room_num != ?");
//get all data where room_num is not equal to the room numbers stored in excludeRooms
result = stmt.executeQuery();
while (result.next()) {
d.add(result.getString("room_num");
d.add(result.getString("room_type");
}
PS. I'm a total newbie in Java and is trying to create a program alongside learning on my own. This is also my first time to post a question here so I hope you could bear with me on my formatting. Thank y'all in advance!