Dear
I use Lazarus 0.9.22 on Linux I386 Ubuntu Gusty (Debian 4)

I would like to use tdbf component.

But when i compile i have errors :

unit1.pas(19,36) Hint: Parameter "Dbf" not used
unit1.pas(19,51) Hint: Parameter "DoCreate" not used
unit1.pas(51,18) Error: Identifier not found "ftAutoInc"
unit1.pas(52,20) Error: Identifier not found "ftString"
unit1.pas(56,38) Error: Identifier not found "ixPrimary"
unit1.pas(56,49) Error: Identifier not found "ixUnique"
unit1.pas(58,41) Error: Identifier not found "ixCaseInsensitive"
unit1.pas(70) Fatal: There were 5 errors compiling module, stopping

Why the "ftAutoInc" is not reachable ???
How to fix it

Best regards...


code :

unit Unit1;

{$mode objfpc}{$H+}

interface

uses
 Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs,dbf,
 Buttons;

type

 { TForm1 }

 TForm1 = class(TForm)
   Button1: TButton;
   Dbf1: TDbf;
   procedure Button1Click(Sender: TObject);
   procedure Dbf1BeforeAutoCreate(Dbf: TDbf; var DoCreate: Boolean);
 private
   { private declarations }
 public
   { public declarations }
 end;

var
 Form1: TForm1;

implementation

{ TForm1 }

procedure TForm1.Dbf1BeforeAutoCreate(Dbf: TDbf; var DoCreate: Boolean);
begin

end;

procedure TForm1.Button1Click(Sender: TObject);
var
  MyDbf: TDbf;
begin
  try
    MyDbf := TDbf.Create(nil);
    { use relative path to "data" directory }
    MyDbf.FilePath := 'data/';
    { we want to use Visual dBase VII compatible tables }
    MyDbf.TableLevel := 7;
    MyDbf.Exclusive := True;
    MyDbf.TableName := 'customers.dbf';
    With MyDbf.FieldDefs do begin
      Add('Id', ftAutoInc, 0, True);
      Add('Name', ftString, 80, True);
    End;
    MyDbf.CreateTable;
    MyDbf.Open;
    MyDbf.AddIndex('custid', 'Id', [ixPrimary, ixUnique]);
    { add a secondary index }
    MyDbf.AddIndex('custname','Name', [ixCaseInsensitive]);
    MyDbf.Close;
  finally
    MyDbf.Free;
  end;
end;

initialization
 {$I unit1.lrs}

end.


--
David Touzeau -------------------------- Linux Ubuntu 7.04 feisty FreePascal-Lazarus,perl,delphi,php artica for postfix management console (http://www.artica.fr) icq:160018849

_________________________________________________________________
    To unsubscribe: mail [EMAIL PROTECTED] with
               "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives

Reply via email to