I have a buffered(5-optimistic )tables in vfp 9.0.when i use delete the records arent deleted
i use tableupdate but they dont get deleted.i use pack but i get a msg saying table should be in no buffered mode
i then change buff to 0 (not programmatically with cursorset.. but from dataenviroment)
but is still get the msg!
how can i delete a record table must be in buffered mode

DELETE FOR-PACK ON BUFFERED TABLES
innivodave
DELETE FROM TempATABLE
=TABLEUPDATE(.T.,.T.,"TempATABLE")
this only marks the record for deletion
if i put pack i get an error saying table cannot be in buffered mode
Dennis Persson
But a cursor IS a temporary table. The only difference is that, as Cindy points out, each user has their own copy and it is therefore alwyas used exclusively. YOu can ZAP and re-use it, you can overwrite it with a different structure at any time - you can index it, set relations, run reports against it in fact do just about anything that you can with a normal table - except persist it from one session to the next.
The key difference is that when the user closes VFP, the cursor is deleted and does not hang around cluttering up disks.
srikanthb
tableupdate doesnt seem to physically delete records in a buffered table,how do i delete them (im talking about old records so tablerevert doesnt help,zap command returns the same as pack.)
Chris Kurz
i prefer tables than cursor because i find them easier to handle,anw ill check that too:)
Prabs
When you issue DELETE in visual FoxPro it does not physically remove the record from the table, it sets a FLAG on the record. You control whether marked records are visible in an application using the SET DELETED ON/OFF command.
In order to physically delete records from a table you must PACK the table. To do that you require exclusive use of the table and so such processes are normally handled as Admin tasks.
When all else has failed, why not read the help file Start with the DELETE command, then PACK.
Vasen_c
I notice that your table is called "Temp..." and that you keep wanting to delete everything and use it again. Have you considered using a cursor It's a temporary table that goes away when you close it or your app closes. Also, each user has his own copy of the cursor so there's no problems with trying to Zap or Pack in shared mode when you want to really get rid of everything. In fact, one way to get rid of everything is to close and recreate the cursor, although you'd need to unset and reset the grid's record source if you did this.
Jan Stuchlik
KABay
delete from myTable
is equivalant to (except some minor differences that you can read from help):
select myTable
delete all
2nd part:
select myTable
delete all
tableupdate(2,.t.,'myTable')
PS: Hope you are not deleting all records from a table to use in a grid, using it for some time and then again deleting all, appending from somewhere etc. I'm about to surrender:)
akosonom
Still, I am trying to delete old records from the table.
My problem here is that the record is marked for deletion but it is not deleted.
I am using a grid to manipulate the table records.
I will display my code in order to have a better view of it.
LOCAL temp
temp = thisform.txtId.Value
SET DELETED OFF
DELETE * from database!myTable;
where myTable.id == temp
=TABLEUPDATE(.t.,.t.,'myTable')
SELECT myTable
GO RECNO()
thisform.Refresh
The table is Optimistic Buffered (Property option No5)
Best Regards
Matt Thubron
When you delete a record it's marked as deleted and in a buffered table you need to call tableupdate() to persist it. If set deleted is off (set deleted is scoped to current data session and by default off) then records would still show up but with a mark in 'deletemark' column. Set deleted on 'hides' them. If you're using a grid then after a delete operation:
go recno()
to force a refresh (normal refresh calls still show the record).
If you're deleting newly added records in a buffered table then instead you might use tablerevert().
Pack needs exclusive usage and table should not be buffered. Pack command needs extra care so do not use it till you fully understand in an application (and it's supposed to be in maintanence routines). Alternative 'packing' strategies like selecting those that are not deleted into another table, zapping original and appending back etc are worth to investigate if you would use it.
Krzysztof Radzimski
Marcelh
thank you in advance for your help
cpf
Delete marks records as 'deleted' (do not physically remove them).
Pack physically removes records marked as 'deleted'.
If you delete records in a buffered table but do not call Tableupdate() then records are not marked as 'deleted' (on disk version).
Zap is NOT the same as pack. Zap removes all records physically not just the ones marked as 'deleted'.