Answer the question
In order to leave comments, you need to log in
Why is it not displaying data from the table?
I want to display a row with the user id from the table
public static void getUserId(Label label) throws SQLException {
Statement st = null;
ResultSet rs = null;
String selectId = "SELECT user_id FROM users;";
try {
st = conn.createStatement();
rs = st.executeQuery(selectId);
while(rs.last()) label.setText("ID: " + rs.getString(1));
}
catch (SQLException e){
e.printStackTrace();
}
}
Answer the question
In order to leave comments, you need to log in
Check:
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question