t e m p o r a l 
 d o o r w a y 

Quick Tips For Databases, Data Controls And Data Aware Controls

 
When I try EmptyTable(), use a TBatchUpdate or (Infopower) Pack(), I get a message "Table is busy" or "Table has too many users"

To empty or pack a table, the underlying "physical" table must be set to

1) Exclusive = true for all TTable or descendants referencing the table.

2) Active = false at design time (i.e. in the IDE) for a TTable or descendant.

3) Active = false at design time (i.e. in the IDE) for any TQuery or descendant.

4) Active = false at design time (i.e. in the IDE) for any other TBDEDataset descendant.

Item (2) can be handled at design time by keeping Exclusive = true data sets inactive and opening them at run time.

(4) can be handled by searching the Sessions->Session->Databases->Datasets (this is not the literal notation) for the alias/table name at run time prior to the operation and inactivating any found datasets until the operation is complete.

(3) requires bracketing the operation with setting known SQL using the table to the inactive state. Theoretically, one might scan all TQuery based datasets for the table name, however, given parameters and other items, this may not be useful.

Also note that EmptyTable requires the table being emptied to have Active = false or you will get the message "Table has too many users".

Don't forget to make sure any work tables referencing the physical table in question are closed and then reopened. Note that packing the table can cause saved TField pointers to point to invalid data; such pointers should be reloaded from the table component.

2/1/99
The BDE claims to allow editable joins, but my join isn't editable. How come?

The BDE is not required to create an editable join and there are a number of reasons why setting a TQuery RequestLive = true may not return a live result set (note that you cannot test RequestLive to determine if the data set is editable, however, in the debugger you can look in the "Data" tab of the inspector for your TQuery and find FCanModify, which will tell the truth).

Look at LocalSQL.hlp in the BDE directory and search for "updatable queries" to see the conditions under which RequestLive = true will not work.

Among the possible reasons for failure not mentioned in the documentations is that the IDs used in the join do not match exactly in format. For instance, the BDE will allow you to join two tables on a key which is CHAR(30) in one and CHAR(20) in the other, but it will not allow that query to be editable; to have a successful RequestLive, you must change them both to be exactly the same format (CHAR 30 or 20 - take your pick).

11/20/98
Ever wonder why a TBatchMove seems to ignore your filter? Use TTable->BatchMove to perform any batch move operation which must respect filters on the source.  

InfoPower (http://www.woll2woll.com) Only

Annoyed that TwwIncrementalSearch components don't handle numbers and dates the way they handle character strings? Add a character field to your table for any date or numeric field you want to incrementally search. Then, in the BeforePost for that table, update the character version of the field from the numeric or date version. Assign the character version of the field as the field for the incremental search, and it will behave as expected. 8/10/98
Need to have a field in a grid be read only but don't want to make it read only in the data set? Attach a read-only TEdit to that column of the grid. 8/10/98
Having trouble when you set the lookup value of a TDBLookupCombo or a TwwDBLookupCombo - the displayed value prior to drop down does not change to the new value? Set the combo->Text property to the correct value. Infopower 3.02b and above, try RefreshDisplay() 8/10/98
Getting a TDBGrid Index Out of Range error? You probably have the same data aware control bound to more than one grid.  
Does a grid for a table lose fields after you set up a TwwDBLookupCombo for that table?

Make sure to associate the lookup combo with a TTable that is different from the one used in the grid. Once you specify fields for the grid and the combo, use of the combo overrides the fields in the grid. I usually make a copy of the primary TTable and end its name with "Lookup".

Alternatively, make sure one or the other has Use TFields unchecked in the Selected property dialog before saving the fields the first time.

 
Copyright © 2004 by Mark Cashman (unless otherwise indicated), All Rights Reserved