DeleteRecord()

Summary

Deletes a record from a view.

Syntax

DeleteRecord(string view_name, string rec_handle)

Argument Contents
view_name The view containing the record to be deleted; if null, the current view is used.
record_handle The record to be deleted; if null, the current record is deleted.

Notes

  • If the deleted record is the current record (e.g., when the input record_handle is null), the view has no current record after the deletion. Aside from this case, DeleteRecord() does not change the current record.

  • Records cannot be deleted from comma-separated text tables or joined views. Records are marked for deletion in dBASE tables, standard geographic files, fixed-format text tables, and fixed-format binary tables. Records can be deleted from ODBC tables if you have the proper permissions.

  • When a record is marked for deletion, the record is not physically removed from the file. Instead, it will be deleted the next time the file is rewritten. You can rewrite a file by saving a copy with the File-Save As command, deleting the old table files, and renaming the new table files to the old table file name. You can also use the CopyTableFiles(), DeleteTableFiles(), and RenameTableFiles() functions in a GISDK macro.

  • Records that are marked for deletion are ignored by GISDK.

  • See also the notes for GetRecordCount().

Example

rh = LocateRecord("U.S. States", ...)
DeleteRecord("U.S. States", rh)

Error Codes

Error Type Meaning
Error Record_handle is null and the view has no current record; record_handle is invalid; or file writing errors (e.g. required file is read-only) occurred.
NotFound The specified view does not exist.

See Also

Function Summary
GetRecord() Gets the record handle of the current record of a view
SetRecord() Sets the current record of a view
AddRecord() Adds a record to a table and sets the current record
DeleteRecordsInSet() Deletes all of the records in a selection set from a view