unit Unit1;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, Forms, Controls, Graphics, Dialogs, DBGrids, StdCtrls,
  xdbf, db, Buttons;

type

  { TForm1 }

  TForm1 = class(TForm)
    DBGrid1: TDBGrid;
    xDbf1: TxDbf;
    DataSource1: TDataSource;
    Button1: TButton;
    Button2: TButton;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
  private

  public

  end;

var
  Form1: TForm1;

implementation

{$R *.lfm}

{ TForm1 }

procedure TForm1.Button1Click(Sender: TObject);
begin
 
     with xDbf1 do
     begin
     Insert;
       FieldByName('name').AsString := ' ';
       FieldByName('tel').AsString :=  ' ';
     Post;

     end;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
  with xDbf1 do
begin
  Delete;
end;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin

if xDbf1.Active then xDbf1.Close;
xDbf1.TableName:= 'tab1.dbf';
xDbf1.Open;

end;

end.

