| Oracle® Objects for OLE Developer's Guide 11g Release 2 (11.2) for Microsoft Windows Part Number E12245-01 |
|
|
View PDF |
Applies To
Description
Deletes the current row of the specified dynaset.
Usage
oradynaset.Delete oradynaset.DbDelete
Remarks
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 CommitTrans or Rollback method.
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 MoveFirst, MovePrevious, MoveNext, or 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 anEdit, AddNew, or Delete method, cancels any outstanding Edit or AddNew calls before proceeding. Any outstanding changes not saved using an Update method are lost during the cancellation.Examples
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