Board index » delphi » Index dbase III with memo

Index dbase III with memo

Hello,

I get the following error when creating a dBase III+ file
(BDE configuration, drivers dBase level 3) with a memo field.
I have a project where a new Delphi 4.0 application has to be
added to an existing dBase III+/Clipper Summer 97 application.

procedure TForm1.btTestClick(Sender: TObject);
begin
  with TTable.Create(Self) do
    begin
      DatabaseName  := '';
      TableName     := 'Register.dbf';
      TableType     := ttDBase;
      with FieldDefs do
        begin
          Add('CLIENT_NO',ftString,7,false);
          Add('DATE',ftDate,0,false);
          Add('PAIDFEES',ftFloat,0,false);
          Add('INACTIVE',ftBoolean,0,false);
          Add('APPOINTMENTS',ftInteger,0,false);
{If the next line is not added to the program, no error occurs}
          Add('notes',ftMemo,0,false);

        end;
      CreateTable;

{Delphi returns the following error when adding an index if dBase driver
level is 3
 and a ftMemo field is defined within FieldDefs:

   Project Test.exe raised exception class EDBEngineError with message
   "Table level changed". Process stopped. Use Step or Run to continue  }

      with IndexDefs do
        begin
          clear;
          AddIndex('Register','CLIENT_NO',[]);
        end;
    end;
end;

Who can help me before this project is turning into a disaster.

Thanks,

Hubert

 

Re:Index dbase III with memo


On Thu, 20 May 1999 14:29:32 +0200, "Hubert Anemaat"

Quote
<anemaat_engineer...@compuserve.com> wrote:
>I get the following error when creating a dBase III+ file
>(BDE configuration, drivers dBase level 3) with a memo field.
>I have a project where a new Delphi 4.0 application has to be
>added to an existing dBase III+/Clipper Summer 97 application.

I've never seen a memo field being to cause of getting a higher table
level than requested.  The numeric fields can cause problems, though.
I'd change the code to:

       with FieldDefs do
       begin
          Add('CLIENT_NO',ftString,7,false);
          Add('DATE',ftDate,0,false);
          Add('PAIDFEES',ftBCD,2,false);
          Items[Count - 1].Precision := 15;  // Field length
          Add('INACTIVE',ftBoolean,0,false);
          Add('APPOINTMENTS',ftBCD,0,false);
          Items[Count - 1].Precision := 4;  // Field length
          Add('NOTES',ftMemo,0,false);
       end;
       CreateTable;

HTH,

Jan

Re:Index dbase III with memo


Quote
Jan Sprengers wrote in message <37442828.9209...@forums.inprise.com>...

>I've never seen a memo field being to cause of getting a higher table
>level than requested.  The numeric fields can cause problems, though.
>I'd change the code to:

>       with FieldDefs do
>       begin
>          Add('CLIENT_NO',ftString,7,false);
>          Add('DATE',ftDate,0,false);
>          Add('PAIDFEES',ftBCD,2,false);
>          Items[Count - 1].Precision := 15;  // Field length
>          Add('INACTIVE',ftBoolean,0,false);
>          Add('APPOINTMENTS',ftBCD,0,false);
>          Items[Count - 1].Precision := 4;  // Field length
>          Add('NOTES',ftMemo,0,false);
>       end;
>       CreateTable;

I have no problem creating the table, but if I add an index to
this table I get the error :

Project AKTIEFM.EXE raised exception class EDBEngine with
message 'Table level changed'.

This error also occurs if there are no numerical fields. If the ftMemo field
is ommitted, Delphi creates REGISTER.MDX in stead of an NDX file !
.MDX is a dBase 4 index. First of all, I do not want this index but a .NDX
index and second, I get the above mentioned error if ftMemo's are used.

Hubert

Re:Index dbase III with memo


On Sat, 22 May 1999 17:20:46 +0200, "Hubert Anemaat"

Quote
<anemaat_engineer...@compuserve.com> wrote:
>I have no problem creating the table, but if I add an index to
>this table I get the error :

>Project AKTIEFM.EXE raised exception class EDBEngine with
>message 'Table level changed'.

The fact that you put the comment containing the error message right
after the CreateTable call confused me.  But the error that you're
getting does make sense .  TTable.AddIndex cannot create
non-maintained DBase indexes (.NDX), only DBase IV MDX-indexes.

The fact that you're getting the error when you add a memo field is
because the DBase III+ memo file format is not the same as DBase IV's
(although they both have a .DBT extension).  But with or without the
memo field, the problem is the same: you need another method to create
the DBase III indexes.

You can either use the BDE function DbiAddIndex or download Jstable
using one of the following links:
  http://sunsite.icm.edu.pl/delphi/ftp/d30free/jstbl.zip
  http://www.torry.ru/vcl/database/jstbl.zip

Good luck,

Jan

Other Threads