Hi,
I'm having some issues with getting next data from the database, it seemed to be working before, but now it doesn't change the textfields to the next data just appends the data into TextArea1 and TextArea2, the other data TextField1 etc.. Doesn't even change, so I do not know why this is happening. Been trying to figure out I can get the next data from the database for about 3 hours would really love some help.Anyone like to shine some light into this?
Thanks
Kru
` private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
// Next Button
Connection con = null;
PreparedStatement ps = null;
ResultSet rs = null;
String host = "xxxx";
String uName = "xxxx";
String uPass = "xxxx";
try {
con = DriverManager.getConnection(host,uName,uPass);
ps = con.prepareStatement("SELECT * FROM Job",ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
rs = ps.executeQuery();
// String sql = "SELECT Customer.Firstname,Customer.Surname,Customer.TelephoneNo, ";
if(rs.next()) {
int id = rs.getInt("JobID");
Date date = rs.getDate("JobDate");
String status = rs.getString("Status");
String description = rs.getString("Description");
String mechanic = rs.getString("Mechanic");
Time duration = rs.getTime("Duration");
// int customer = rs.getInt("CustomerID");
String txtID = Integer.toString(id);
jTextField1.setText(txtID);
jTextField2.setText(date.toString());
jTextArea1.append(status);
jTextArea2.append(description);
jTextField3.setText(mechanic);
jTextField4.setText(duration.toString());
System.out.println(id + "" + date + status + description + mechanic + duration );
}
} catch(SQLException e) {
e.getMessage();
} finally {
try {
if(con != null) {
con.close();
System.out.println("CLOSED!!");
}
if (ps != null) {
ps.close();
}
if(rs != null) {
rs.close();
}
} catch (SQLException e) {
System.out.println("Exception has been caught");
}
}
} `