user3490413
user3490413

Reputation:

VB.Net with Oracle ODP.net transaction with read_committed isolation returns original values after first call

I have set up a Transaction with isolation level READ_COMMITTED using VB.net and Oracle ODP.net

Dim OraTransaction As OracleTransaction = oraConnection.BeginTransaction(IsolationLevel.ReadCommitted)

It is declared within a Function block and right after, a FOR loop runs with several Sub calls inside passing the Connection object's reference. During the execution a Select is issued and two fields from that Table change.

The very first iteration, the Select command, using a DataAdapter object, returns the stored values as expected. During the execution the values of the fields change and then I use a Command object to execute an update, but not commit yet.

When the second iteration issues the aforementioned Select, instead of the updated values, the query still returns the original values.

Thank for any help.

J.

Upvotes: 0

Views: 337

Answers (1)

user3490413
user3490413

Reputation:

Looking for another way to persist the changes, I found out that there was an error in the Select query I was using to pull data from the Table.

If I execute an Update command to the Table and then execute a Select command, it actually returns the updated values. When manually throwing an exception before the Transaction completes, all the changes at that point are rolled back and when the Transaction completes, it successfully commit the changes, which is exactly what I wanted to achieve.

Upvotes: 0

Related Questions