begin
with Table1 do
begin
Active := False;
DatabaseName := 'DOCTOR';
TableType := ttParadox;
TableName := 'DOCTORINF23';
if not Table1.Exists then begin
with FIEldDefs do begin
Clear;
with AddFIEldDef do begin
Name := '姓名';
DataType := ftString;
Required := True;
Size := 10;
end;
with AddFIEldDef do begin
Name := '年齡';
DataType := ftInteger;
end;//建立字段定,利用AddFieldDef方法添加一個新的TFIEldDef對象
with AddFIEldDef do begin
Name := '職稱';
DataType := ftString;
Required := True;
Size := 10;
end;
end;
with IndexDefs do begin
Clear;
with AddIndexDef do begin
Name := 'MYINDEX';
FIElds := '姓名';
Options := [ixPrimary];
end;
end; //建立索引
end;
CreateTable;
end;
//Table1.Append ;
Table1.Open;
Table1.Edit;
Table1.FIEldByName('姓名').AsString:='劉延';
Table1.FIEldByName('年齡').AsInteger:=22 ;
Table1.FIEldByName('職稱').AsString:='醫師';
Table1.Append;
Table1.Edit;
Table1.FIEldByName('姓名').AsString:='楊曉';
Table1.FIEldByName('年齡').AsInteger:=25 ;
Table1.FIEldByName('職稱').AsString:='醫師';
DBGrid1.DataSource:=DataSource1;
Table1.Active :=True;
end;