var ss:TArrayField ; begin try ss:=TArrayField.Create(nil); with ss do begin ss.DataSet := table1; 操作ss即可 ; end; finally FreeAndNil(ss) end; end;
Using the array field's FieldValues propertyYou can access the value of a child field with the array field's FieldValues property. FieldValues accepts and returns a Variant, so it can handle and convert child fields of any type. For example, TelEdit.Text := TArrayField(Customer.FieldByName('TelNos_Array')).FieldValues[1];Because FieldValues is the default property of TArrayField, this can also be writtenTelEdit.Text := TArrayField(Customer.FieldByName('TelNos_Array'))[1];Using the array field's Fields propertyTArrayField has a Fields property that you can use to access individual sub-fields. This is illustrated below, where an array field (OrderDates) is used to populate a list box with all non-null array elements:for I := 0 to OrderDates.Size - 1 do begin if not OrderDates.Fields[I].IsNull then OrderDateListBox.Items.Add(OrderDates[I]); end;
ss:TArrayField ;
begin
try
ss:=TArrayField.Create(nil);
with ss do
begin
ss.DataSet := table1;
操作ss即可 ;
end;
finally
FreeAndNil(ss)
end;
end;
begin
if not OrderDates.Fields[I].IsNull then
OrderDateListBox.Items.Add(OrderDates[I]);
end;