Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Delete All Rows vs Delete Entire File?
Message
From
28/09/2001 15:41:04
Keith Payne
Technical Marketing Solutions
Florida, United States
 
 
To
27/09/2001 15:13:32
Peter Brama
West Pointe Enterprises
Detroit, Michigan, United States
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00561614
Message ID:
00562071
Views:
28
>I have a label program I am writing that has a routine that uses a SELECT SQL to build a new table to be used for a grid. In this table, a couple fields can be editable and changed for this one session as well as a new field being added for input. This table has 6 fields out of a possible 60 from the source file.
>
>Before the select, if the table FILE() exists, I delete that and the associated CDX file. The SQL creates that table again and an INDEX ON creates the indexs I need for this "session"
>
>I originally was going to just mark all the rows for DELETE and add to the table with the SQL but I am worried about table physical disk space size for this could be run several times per day. I know I can PACK a table but thought just deleting it would work just the same.
>
>The problem I am experiencing now is most likely due to remove/add the table. I have a grid on a form that is driven by the table. I have a button that lets the user select a new file with the intention that the grid would be reloaded with the new data. The routine calls the above steps and the grid turns to an empty white box with no rows, columns or headers. Exiting out and checking the table, the NEW data that was selected is loaded properly.
>
>Any suggestions on how to handle this. Keep in mind, I need to be able to edit field data, select data, add a new field to this table (it is a small fraction of the number of fields from the source file) for input use.

Peter,

A good way to prevent the grid from self-destructing is to create a cursor with the same structure as the original table. You can do this on the fly with the COPY STRUCTURE command. Then redirect the grid by changing the record source and the control source of the grid's columns and controls to point to the new cursor. Then delete original table, create the new table and finally redirect the grid to your new table.
Previous
Reply
Map
View

Click here to load this message in the networking platform