Board index » delphi » BDE: can't create tables if DBASE level 7

BDE: can't create tables if DBASE level 7

Hello,
I used to create dbase tables via SQL or via table.fielddefs related
functions and all worked well until I came to Delphi 4 and BDE 5.x Now I
found that if the DBASE Level in DBE Admin is set to 7 (the default
setting), it is impossible to create tables with numeric fields, in fact
size If I change the level to 5 or less, all works fine. Worst of all, no
exception is raised while creating the table.
Is there an explanation for such a strange behavior?
 

Re:BDE: can't create tables if DBASE level 7


Re:BDE: can't create tables if DBASE level 7


Andrea,

Quote
> I used to create dbase tables via SQL or via table.fielddefs related
> functions and all worked well until I came to Delphi 4 and BDE 5.x Now I
> found that if the DBASE Level in DBE Admin is set to 7 (the default
> setting), it is impossible to create tables with numeric fields, in fact
> size If I change the level to 5 or less, all works fine. Worst of all, no
> exception is raised while creating the table.
> Is there an explanation for such a strange behavior?

I personally believe that it's a bug in BDE 5, but Borland says it is not.
Call the following code passing along the TTable and the table level that
you want to create before creating the table.

procedure SetTableLevel(aTable: TTable; aLevel: Integer);
var
n : Integer;
FieldDef : TFieldDef;
begin
if aLevel = 7 then Exit; {no need to process if 7 is ok}
for n := 0 to aTable.fieldDefs.count-1 do begin
    FieldDef := aTable.fieldDefs[n];
    case FieldDef.DataType of
         ftSmallInt: begin
           FieldDef.DataType := ftBCD;
           FieldDef.Size := 0;
           FieldDef.Precision := 6;
           end;
         ftInteger: begin
           FieldDef.DataType := ftBCD;
           FieldDef.Size := 0;
           FieldDef.Precision := 11;
           end;
         ftFloat: begin
           FieldDef.DataType := ftBCD;
           FieldDef.Size := 4;
           FieldDef.Precision := 20;
           end;
    end;
end;
aTable.TableLevel := aLevel;
end;

--

  ---------------------------------------
  Terry Swiers
  Millennium Software, LLC
  http://www.1000years.com

  Atrex Inventory Control/POS -
     '99 Shareware Industry Awards Nominee
     '96, '97, '98 - Ziff-Davis/PC Magazine Shareware Award Finalist
  ---------------------------------------

Re:BDE: can't create tables if DBASE level 7


Re:BDE: can't create tables if DBASE level 7


On Tue, 3 Aug 1999 10:48:35 +0200, "Andrea F." <and...@microsoftware.it>
wrote:

Quote
>I used to create dbase tables via SQL or via table.fielddefs related
>functions and all worked well until I came to Delphi 4 and BDE 5.x Now I
>found that if the DBASE Level in DBE Admin is set to 7 (the default
>setting), it is impossible to create tables with numeric fields, in fact
>size If I change the level to 5 or less, all works fine. Worst of all, no
>exception is raised while creating the table.
>Is there an explanation for such a strange behavior?

What are you saying? That adding TFieldDef objects to a TTable's FieldDefs
property and then calling the CreateTable method does not raise an
exception, but also does not create a table? Can you give an example of the
TFieldDef object value assignments?

Or is your problem when using SQL? If so, what SQL statement causes the
conditions you describe?

_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
Steve Koterski         "Television is a medium because anything well done
Felton, CA             is rare."
                                                 -- Fred Allen (1894-1956)

Other Threads