|Oracle® Objects for OLE Developer's Guide
11g Release 2 (11.2) for Microsoft Windows
Part Number E12245-01
Deletes the current row of the specified dynaset.
A row must be current before you can use the
Delete method; otherwise, an error occurs.
Note that after you call the
Delete method on a given row in a dynaset in a global transaction (that is, once you issue a
BeginTrans method), locks remain on the selected rows until you call a
Any references to the deleted row produce an error. The deleted row, as well as the next and previous rows, remain current until database movement occurs (using the
MoveLast methods). Once movement occurs, you cannot make the deleted row current again.
You cannot restore deleted records except by using transactions.
Note:A call to an
Deletemethod, cancels any outstanding
AddNewcalls before proceeding. Any outstanding changes not saved using an
Updatemethod are lost during the cancellation.
This example demonstrates the use of the
Delete method to remove records from 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. Only select the employees in Department 10. Set OraDynaset = OraDatabase.CreateDynaset("select * from emp where" & _ "deptno=10", 0&) Do Until OraDynaset.EOF OraDynaset.Delete OraDynaset.MoveNext Loop MsgBox "All employees from department 10 removed." End Sub