a) właściwość FIELDS :TFields;
np. dla x:integer;
x:=Table1.Fields[0].AsInteger;
dla s:string;
s:=Table1.Fields[2].AsString;
[n] - numer pola w bieżącym rekordzie tabeli
b) metoda FieldByName(const FieldName: string):TField;
np.:
dla x:integer;
x:=Table1.FieldByName('Wiek').AsInteger;
c) właściwość FieldValues:Variant;
x:=Table1.FieldValues['Wiek'];
albo po prostu:(!!!)
x:=Table1['Wiek'];
Table1.Edit;
Table1.Post;
Table1.Append;
Table1.delete;
Table1.Cancel;
np.
with Table1 do begin Append; FieldValues['Nazwisko']:='Kowalski; FieldValues['Wiek']:=21; Post; end;
Table1.First; {lub FindFirst}
Table1.Last; {lub FindLast}
Table1.Next; {lub FindNext}
Table1.Prior; {lub FindPrior}
Table1.MoveBy(n);
Metody: .BOF , .EOF :boolean
np:
i:=1;
Table1.First;
while not Table1.EOF do
begin
Table1['Lp']:=i;
i:=i+1;
end;
Table1.Refresh;
właściwość:
STATE:TDataState=(dsInactive, dsBrowse, dsEdit, dsInsert, dsSetKey, dsCalcFields, dsFilter, sNewValue, dsOldValue, dsCurValue, dsBlockRead, dsInternalCalc);
właściwości:
FILTER:string;
FILTERED:boolean;
np.
Table1.filter:='WIEK<18';
Table1.Filtered:=true;
Table1.Refresh;
Metoda .Locate
Locate(const KeyFields: string; const KeyValues: Variant; Options: TLocateOptions): Boolean;
gdzie: TLocateOptions = (loCaseInsensitive, loPartialKey);
np.:
Table1.Locate('Nazwisko','Kowalski,[]);
Table1.Locate('Nazwisko;Wiek', VarArrayOf(['Kowal', 23]), [loPartialKey]);
with table1 do
begin
Close;
TableName:='tabDBF';
TableType:=ttDBase; {ttParadox}
{definiowanie pól}
{typy pól: ftString, ftFloat, ftInteger,...}
{4-ty parametr wskazuje czy wartość pola jest wymagana}
with FieldDefs do
begin
Clear;
Add('pole1',ftAutoInc,0,true);
Add('pole2',ftString ,15,true);
Add('pole3',ftString ,15,false);
Add('pole4',ftInteger,10,false);
Add('pole5',ftString ,10,false);
end;
{tworzenie indeksów}
with IndexDefs do
begin
clear;
Add('','pole1',[ixPrimary]);
//3-ci par.:[ixPrimary, ixUnique, ixDescending,...]
//dla Primary Key nazwa nie jest konieczna
Add('pole2','pole2',[]);
Add('pole3','pole3',[]);
//ale można skonstruować indeks z kilku pól, np:
Add('ind1','pole2;pole3',[]);
//separator - ";"
end;
CreateTable;
Addindex('pole4','pole4',[]);
Open;
IndexDefs.Update;
IndexFieldNames:='pole2'; {albo IndeksName:='ind1';}
end;
{...}
Table1.Close;