Compartir a través de


How to: Append and Delete Records in Table Buffers

You can append and delete records while table buffering is enabled: appended records are added to the end of the buffer. To access all records in the buffer, including appended records, use the RECNO( ) Function. The RECNO( ) function returns sequential negative numbers on records you append to a table buffer. For instance, if you initiate table buffering, edit records 7, 8, and 9, and then append three records, the buffer will contain RECNO( ) values of 7, 8, 9, – 1, – 2, and – 3.

Note

Tables containing automatically incrementing field values append table-buffered records approximately 35% slower than tables without automatically incrementing field values, which might affect performance. When using table buffering, the table header is locked when the record is appended.

Buffer after editing and appending records

EditedTableBuffer2 graphic foxpro

You can remove appended records from the buffer only by using the TABLEREVERT( ) Function. For any appended record, both TABLEUPDATE( ) and TABLEREVERT( ) delete the negative RECNO( ) value for that record while maintaining the sequence.

Buffer after editing, deleting an appended record, and appending another

EditedTableBuffer graphic foxpro

While using a table buffer, you can use the GO command with the negative RECNO( ) value to access a specific appended record. For instance, using the previous example, you can type:

GO 7      && moves to the 1st buffered record
GO -3      && moves to the 6th buffered record (3rd appended)

To append records to a table buffer

  • Use the APPEND or APPEND BLANK command after you enable table buffering.

Appended records have sequential ascending negative RECNO( ) numbers.

To remove an appended record from a table buffer

  1. Use the GO | GOTO Command with a negative value to position the record pointer at the record to be deleted.

  2. Use the DELETE Command to mark the record for deletion.

  3. Use the TABLEREVERT( ) Function to remove the record from the buffer.

    Note

    The TABLEREVERT() function also affects the status of deleted and changed rows.

To remove all appended records from a table buffer

TABLEREVERT( ) removes appended records from a table buffer without writing the records to the table. TABLEUPDATE( ) writes all current buffered records to a table, even if they've been marked for deletion.

See Also

Tasks

How to: Enable Buffering

How to: Use Data Sessions

Concepts

Buffering Data

Reference

CURSORSETPROP( ) Function

Other Resources

Updating Data

Programming for Shared Access

Controlling Access to Data