Edit method causes the locally cached data to be compared to the corresponding row of an Oracle Database. An error is generated if Oracle Database data is not the same as the data currently being browsed. If this operation succeeds, the row is locked using a
UPDATE" statement until the edit is completed with an
Update method or until database movement occurs, which discards any edits in progress. The behavior of the
UPDATE" statement is affected by the
Wait mode of the options flag used when the
OpenDatabase method was called.
Note:The cached data is not compared to the database with
REF, and collection types, and the data is updated regardless (dirty writes).
During editing, changes made to fields are kept in a shadowed copy buffer and do not yet reflect the actual contents of the database. However, all references to the row return the newly modified data as long as the edit operation is still in progress.
When data is modified within a data control attached to this dynaset, the
Edit method is invoked automatically upon the next record movement. Thus, this method is required only when modifications are made to field data within code.
Note:A call to an
Deletemethod cancels any outstanding
AddNewcalls before proceeding. Any outstanding changes not saved using an
Updateoperation are lost during the cancellation.
This example demonstrates the use of the
Update methods to update values in a database. Copy and paste this code into the definition section of a form. Then, press F5.
Sub Form_Load () 'Declare variables Dim OraSession As OraSession Dim OraDatabase As OraDatabase Dim OraDynaset As OraDynaset 'Create the OraSession Object. Set OraSession = CreateObject("OracleInProcServer.XOraSession") 'Create the OraDatabase Object by opening a connection to Oracle. Set OraDatabase = OraSession.OpenDatabase("ExampleDb", "scott/tiger", 0&) 'Create the OraDynaset Object. Set OraDynaset = OraDatabase.CreateDynaset("select * from emp", 0&) 'Traverse until EOF is reached, settingeach employee's salary to zero Do Until OraDynaset.EOF OraDynaset.Edit OraDynaset.Fields("sal").value = 0 OraDynaset.Update OraDynaset.MoveNext Loop MsgBox "All salaries set to ZERO." End Sub