Glenn
2004-09-27 17:13:14 UTC
Hi Al
I need to ascertain whether or not a field exists in a paradox table. I am
using delphi 4, and this is proving to be harder than I thought (my fault I
know).... From the help files and google I have pieced together the
following that I have built into a function
function FieldExist(DataSet: TDataSet; FieldName: String): Boolean;
var
findField: TField;
begin
findField := nil;
findField := DataSet.FindField(FieldName);
if Assigned(findField) then CreateField:=False//if field exists do nothing
else CreateField:=True;//else create the field
end;
Where dataset is TTable, and FieldName is the name of the field I am looking
for...
I would expect the CreateField variable (boolean) to be true if the field is
not found and false if the field is found. However I get the same result
whether the filed is in the database or not?
Help much appreciated.
Cheers
Glenn
I need to ascertain whether or not a field exists in a paradox table. I am
using delphi 4, and this is proving to be harder than I thought (my fault I
know).... From the help files and google I have pieced together the
following that I have built into a function
function FieldExist(DataSet: TDataSet; FieldName: String): Boolean;
var
findField: TField;
begin
findField := nil;
findField := DataSet.FindField(FieldName);
if Assigned(findField) then CreateField:=False//if field exists do nothing
else CreateField:=True;//else create the field
end;
Where dataset is TTable, and FieldName is the name of the field I am looking
for...
I would expect the CreateField variable (boolean) to be true if the field is
not found and false if the field is found. However I get the same result
whether the filed is in the database or not?
Help much appreciated.
Cheers
Glenn
--
Kind Regards
Glenn Greatwood
Key-Data Systems
www.key-data.co.uk
Kind Regards
Glenn Greatwood
Key-Data Systems
www.key-data.co.uk