ResultSet update
In this chapter you will learn:
Updating a Result Set
The ResultSet interface has methods for updating the data. There are two update methods for each data type:
- Update by a column name.
- Update by a column index.
For example
public void updateString(int columnIndex, String s)
Update the String by columnIndex.public void updateString(String columnName, String s)
Update the String by columnName.
Updating a row in the result set changes in the ResultSet object, but not in the underlying database. To update the database, we have to invoke one of the following methods.
public void updateRow()
Updates the current row in the database.public void deleteRow()
Deletes the current row from the databasepublic void refreshRow()
Refreshes the data in the result set to reflect any recent changes in the database.public void cancelRowUpdates()
Cancels any updates made on the current row.public void insertRow()
Inserts a row into the database when the cursor is pointing to the insert row.
Next chapter...
What you will learn in the next chapter:
Home » Java Tutorial » Statements, ResultSet, Exception, Warning