Skip Headers
Oracle® Objects for OLE Developer's Guide
11g Release 2 (11.2) for Microsoft Windows

Part Number E17727-03
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Master Index
Master Index
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
PDF · Mobi · ePub

Update Method

Applies To

OraDynaset Object

Description

Saves the copy buffer to the specified dynaset.

Usage

oradynaset.Update
oradynaset.DbUpdate 

Remarks

The Update method completes an AddNew or Edit operation and immediately commits changes to the database unless a BeginTrans operation is pending for the session.

Once the Update method is called on a given row in a dynaset in a global transaction (that is, a BeginTrans operation is issued), locks remain on the selected rows until a CommitTrans or Rollback method is called.

The mirrored data image is also updated so that the query does not have to be reevaluated to continue browsing and updating data. The method used for updating the mirror image is subject to the options flag that was passed to the OpenDatabase method that created the OraDatabase object of this dynaset.

If this dynaset is attached to a data control, then the Validate event of the data control code may optionally cancel the update request. If the update completes, then all bound controls associated with the dynaset are notified of the update so they can reflect the data changes automatically.

Examples

This example demonstrates the use of AddNew and Update methods to add a new record to a dynaset. 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&)
 
'Begin an AddNew.
OraDynaset.AddNew
 
'Set the field(column) values.
OraDynaset.Fields("EMPNO").Value = "1000"
OraDynaset.Fields("ENAME").Value = "WILSON"
OraDynaset.Fields("JOB").Value = "SALESMAN"
OraDynaset.Fields("MGR").Value = "7698"
OraDynaset.Fields("HIREDATE").Value = "19-SEP-92"
OraDynaset.Fields("SAL").Value = 2000
OraDynaset.Fields("COMM").Value = 500
 
OraDynaset.Fields("DEPTNO").Value = 30
 
'End the AddNew and Update the dynaset.
OraDynaset.Update
 
End Sub