CB4 Tables FAQ


?  Are there any demos on how I can use CB4 Tables?

!  They are not really necessary, you can use CB4 Tables in the same manner as you would use a TTable plus a TDatabase. The simplest possible demo (with a GUI) is:

Now start editing, inserting and deleting records...

?  When I open a Table in ReadOnly mode and then open the same Table (in an other dataset) not readonly, I get the Error: Error Duplicate Instance Found Error Opening File (-69)

!  This is due to an error in CodeBase. If you have opened a table in a restrictive way first, other instances of that table can only be openend in the same or a more restrictive way as long as the first table is open. A workaround is using a different Database for that table.

?  I want to use a function that is in CodeBase (like pack or reindex) but it is not implemented in TCB4Tables/TCB4Database, how do I do that.

!  You can do this just by calling the appropriate CodeBase function. In this function you can use the property TCB4Table.CBDATA4 for d4* functions and TCB4Database.CBCODE4 for c4* functions. For Example to pack a table just do d4pack(CB4Table.CBDATA4).

?  It is very slow when I set a range on a table, (when there are a lot of records in the range).

!  This is probably because you use a KeyInclusive range end in stead of a KeyExclusive. For example if you want to set a range on all records that have CustNo=2, you would normally do so by setting both range start and range end on CustNo=2, but you can also do this as follows:

CB4Table1.FieldByName('CustNo').Value := 2;
CB4Table1.KeyExclusive := False; // default value, so not really necessary
CB4Table1.FieldByName('CustNo').Value := 3;
CB4Table1.KeyExclusive := True; // this says don't include 3!!!

Now CB4 Tables will search for a CustNo 3 and skip back until it finds something other then 3. For more info see the Delphi help on KeyExclusive

Send your questions to tiriss@tiriss.com.