在方法中:
procedure TForm1.ADOTable1SEXGetText(Sender: TField; var Text: String;
DisplayText: Boolean);
begin
if Sender.Asinteger = 1 then
Text:='是' else Text:='否';
end;
Controls how the Boolean field is translated to and from display format.
property DisplayValues: string;
Description
Use DisplayValues to specify strings the field uses to represent Boolean values. Use any pair of phrases, separated by a semicolon. For example, to have the True and False values correspond to the letters T and F, respectively, set DisplayValues as follows:
Table1LogicalField.DisplayValues := 'T;F';
Similarly, to set the values of True and False to the strings Yes and No, set DisplayValues to
Table1LogicalField.DisplayValues := 'Yes;No';
The string associated with True or False can be an empty string. To set the value for True to an empty string, set DisplayValues to a string that begins with a semicolon. For example, to associate False with the string Fail, and True with an empty string, set DisplayValues to
Table1LogicalField.DisplayValues := ';Fail';
To associate False with an empty string, set DisplayValues to the string for True, with no semicolon at all.
The strings associated with True and False by DisplayValues appear in data-aware controls when they display the data for a Boolean field. If one of the strings is an empty string, Boolean values associated with that string appear blank in data-aware controls.
These strings are also used when getting or setting the Boolean field抯 AsString property.