About Question enthuware.ocpjp.v7.2.1686 :

All the posts and topics that contain only an error report will be moved here after the error is corrected. This is to ensure that when users view a question in ETS Viewer, the "Discuss" button will not indicate the presence of a discussion that adds no value to the question.

Moderators: Site Manager, fjwalraven

Post Reply
renatumb
Posts: 47
Joined: Mon Apr 08, 2013 7:55 pm
Contact:

About Question enthuware.ocpjp.v7.2.1686 :

Post by renatumb »

ResultSet is a read only object. You cannot change (i.e. update) anything in the database using a ResultSet object.
Do you mean the resultset that was created in the question or EVERY/ANY ResultSets ?

I dont know if it is a good practice, but it's possible use a ResultSet to change values in a DB:
To insert:

Code: Select all

ResultSet rs = connection.createStatement( ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE).executeQuery(sql);

rs.moveToInsertRow();
rs.updateObject(column,value);
rs.insertRow();
Update:

Code: Select all

rs.absolute(lineOfTable);
rs.updateObject(column,value);
rs.updateRow();
Delete:

Code: Select all

rs.absolute(lineOfTable);
rs.deleteRow();

admin
Site Admin
Posts: 10388
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.ocpjp.v7.2.1686 :

Post by admin »

You are right. The answer is correct but the explanation is not. This has now been fixed.

thank you for your feedback!
Paul.

Post Reply

Who is online

Users browsing this forum: No registered users and 17 guests