Given the EMPLOYEE table:
Given the code fragment:
Assuming the database supports scrolling and updating, what is the result?
Given the EMPLOYEE table:
Given the code fragment:
Assuming the database supports scrolling and updating, what is the result?
The code uses rs.absolute(-2) to move the cursor to the next to last row, which is Employee Id: 102, Employee Name: Peter. This does not impact the insertion of new data. The subsequent call to rs.insertRow() inserts the new record (104, Michael) into the result set. However, the cursor doesn't move to this new row immediately. The call to rs.moveToCurrentRow() returns the cursor to its state before the insertion, which was positioned at Employee Id: 102, Employee Name: Peter. Therefore, the output will display the current row where the cursor is positioned, which is Employee Id: 102, Employee Name: Peter.
102, peter is printed, tested
Answer is C.
calling the method absolute(-2)moves the cursor to the next-to-last row
Employee Id: 102, Employee Name: Peter is displayed.
Answer is C, new record is inserted and Employee Id: 104, Employee Name: Peter is displayed.
moveToCurrentRow() -> the newest row that we inserted https://docs.oracle.com/javase%2F7%2Fdocs%2Fapi%2F%2F/java/sql/ResultSet.html
A new record is inserted and Employee Id: 104, Employee Name: Peter is displayed.