Home > Back-end >  Adoquery how to add fields in the program?
Adoquery how to add fields in the program?

Time:10-07

Everyone knows double-click adoquery pop-ups can right-click inside the add fields, etc., due to my adoquery query table fields inside are not fixed, and my adoquery there is a calculated field, so I would like to add fields inside the program, you know that?

CodePudding user response:

Can dynamically add. But it is not recommended to do so, this is not desirable
If you want to display 50 field, to add 50 times, and each field to set up the type and length

CodePudding user response:

refer to the original poster hk12312 response:
everyone know double-click adoquery pop-ups can right-click inside the add fields, etc., because of my adoquery query table fields inside are not fixed, and my adoquery there is a calculated field, so I want to have the add in application fields, you know that?

To the computed field with other methods, such as in beforepost processing or in the database, and the field is not fixed, also have asked to display controls, otherwise your computing field is useless,

CodePudding user response:

I mean my salary there
Name the basic salary merit pay overtime
.
But that day maybe I want to change the payroll
Name basic salary merit pay overtime sanjin
,,,
My adoquery I before changes can be combined together, through the ADOQueryCalcFields face wage so I am adoquery double-click add fields, and then the new fields to add a total, but fields to be changed, after the change, so I want to in a program run by the program to add fields and new fields,

CodePudding user response:

Var
Field: TField;
Field:=TField. Create (self);
Field. FieldKind:=fkCalculated;
Field. SetFieldType (ftInteger);
Field. FieldName:='total';
If ADOQuery2. Active=false then
ADOQuery2. Active:=true;
ADOQuery2. Fields. The Add (Field);
In this way can I add a column, but not the column name, exit error,

CodePudding user response:


Field:=TField. Create (ADOQuery3);
Field. FieldKind:=fkCalculated;
Field. SetFieldType (ftInteger);
Field. FieldName:='WM;
Field. The Name:='WM;
Field. DisplayLabel:='us';
ADOQuery3. Close;
Field. The DataSet:=ADOQuery3;
ADOQuery3. Fields. The Add (Field);
ADOQuery3. Open;

Exit times could not find the WM, but I have this column in the database
  • Related