Deleting Records

Records can be deleted by opening a recordset, navigating to the record to be deleted, and then calling the _RecordsetPtr::Delete function to delete the record. It is much more efficient, though, to execute a SQL DELETE statement with a WHERE clause specifying the record or records to be deleted (for example, "DELETE FROM Customers WHERE CustID = 1"). You can execute such code using the _ConnectionPtr::Execute function.

The Execute function takes the following parameters:

  • A BSTR containing the SQL Statement to execute.

  • A VARIANT that contains, on return, the number of rows affected. For example, this would be the number of rows actually deleted.

  • A constant, which is usually AdoNS::adCmdText, indicating that a SQL statement is being ...

Get Windows® CE 3.0 Application Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.