Update Oracle Statement Doesn't Work
I am trying to update a record with VB.Net. This is the code. It doesn't give any error. But every time I run this code iI expect that the variable newbal will increment. It doesn'
Solution 1:
You should use this structure to manage transactions with Oracle (see MSDN docs) :
PublicSub RunOracleTransaction(ByVal connectionString AsString)
Using connection AsNew OracleConnection(connectionString)
connection.Open()
Dim command As OracleCommand = connection.CreateCommand()
Dim transaction As OracleTransaction
' Start a local transaction
transaction = connection.BeginTransaction(IsolationLevel.ReadCommitted)
' Assign transaction object for a pending local transaction
command.Transaction = transaction
Try
command.CommandText = _
"INSERT INTO Dept (DeptNo, Dname, Loc) values (50, 'TECHNOLOGY', 'DENVER')"
command.ExecuteNonQuery()
command.CommandText = _
"INSERT INTO Dept (DeptNo, Dname, Loc) values (60, 'ENGINEERING', 'KANSAS CITY')"
command.ExecuteNonQuery()
transaction.Commit()
Console.WriteLine("Both records are written to database.")
Catch e As Exception
transaction.Rollback()
Console.WriteLine(e.ToString())
Console.WriteLine("Neither record was written to database.")
EndTryEndUsingEndSub
Solution 2:
oracle asks for explicit commit, possible that is missing
Post a Comment for "Update Oracle Statement Doesn't Work"