Home > Back-end >  IQ challenge: the question I have to figure indicating in detail, the key is the red font part can&#
IQ challenge: the question I have to figure indicating in detail, the key is the red font part can&#

Time:10-12


Besides red solution with warrior given, address: http://bbs.csdn.net/topics/390519799? Page=1 # post - 395058726

Please provide the code solution, very thanks!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

CodePudding user response:

I see you two days before had sent a similar post,
I don't know if I fully understand your meaning, my advice is as follows:
I on the payroll of 40-50, but really useful to me no more than 20 items, other also displays, data is only 0,
A city has a lot of department, in addition to basic salary, housing accumulation fund, medicaid (health care card) is the same a few, such as every other every department is different, the bureau of finance is separately for each department will have a payroll? Certainly not, it can be to design one for the whole city each department unified payroll, although some items not to be used for some departments,
Above is the point of gossip, the following is a solution:
Database design nothing but there are three kinds of methods:
1, in view of all the parts design a unified database, can have a common field, there are parts for a field, and
I think this is best,
2, for each component design database, this is a bit complicated,
3, half-way, get the same project number of parts into a group, give them design database,
As for the show, I say the train of thought for the first method:
DBGrid don't fixed display field, query, after the completion of the first record of the result set (should be the) cycle from beginning to end, if a field value is not null (or zero), according to this line of code should be like this:
Var
I, j: integer;
The begin
ADOQuery1. Open;//to complete the first query, condition yourself if
Dbgrid1. Columns. The Clear;
J:=0;
For I:=0 to ADOQuery1. Do FieldCount - 1
If ADOQuery1. Fields [I] AsString<> "' then
The begin
DBGrid1. Columns. The Add;
DBGrid1. Columns [j]. Journal of FieldName:=ADOQuery1. Fields [I] FieldName.
DBGrid1. Columns [j]. Width:=60;
//DBGrid1. Columns [j]. Title caption:=ADOQuery1. Fields [I] FieldName.
//in order to look good, can add to display the field name in Chinese, such as:
A case of I//note that is I, not j
0: DBGrid1. Columns [j]. Title caption:='name';
1: DBGrid1. Columns [j]. Title caption:='length;
2: DBGrid1. Columns [j]. Title caption:='width';
3: DBGrid1. Columns [j]. Title caption:='species';
4: DBGrid1. Columns [j]. Title caption:='diameter';
5: DBGrid1. Columns [j]. Title caption:='purposes;
6: DBGrid1. Columns [j]. Title caption:='ee';
7: DBGrid1. Columns [j]. Title caption:='ff';
8: DBGrid1. Columns [j]. Title caption:='gg';
9: DBGrid1. Columns [j]. Title caption:='hh';
end;
//I don't think it's good idea, only 30 times,
J:=j + 1;
end;
end;




CodePudding user response:

Two figure field name (title) is not symmetrical, I blind,

CodePudding user response:

Table 2 results associated dbgrid each field is visible or not, according to table 1 is to determine the corresponding records

CodePudding user response:

Automatically establish DBEDIT and field symmetry method has been given in your last two posts, I didn't see no?

CodePudding user response:

references to the tenth floor babydog01 response:
can be used to dynamically create methods to achieve, just thinking, improved by oneself,
With the DBEDIT and relevance to the field,
 
Procedure TForm1. Button1Click (Sender: TObject);
Var
Lables: TLabel;
The Edits: TDBEdit;
I: integer;
The begin
For I:=1 to the self. Adoquery1. FieldCount do begin//create many fields with the same number
Lables:=TLabel. Create (self);//create a TAB and set to the field name
Lables. Top: 30 *=I;
Lables. Left:=10;
Lables. Width:=100;
Lables. Height:=25;
Lables. Parent:=the self;
Lables. Caption:=self. ADOQuery1. Fields [I - 1]. FieldName.
Lables. Name:='lable' + trim (inttostr (I));
Lables. Visible:=true;
The Edits:=TDBEdit. Create (self);//create DBEDIT and associated to the related field
The Edits. Top: 30 *=I;
The Edits. Left:=110;
The edits. Parent:=the self;
The Edits. The DataSource:=self. DataSource1;
The Edits. DataField:=self. ADOQuery1. Fields [I - 1]. FieldName;
Edits the Name:='edit' + trim (inttostr (I));
The Edits. Visible:=true;
end;
end;




Turn again

CodePudding user response:

Upstairs if not line, through a button, draw a table display and EDIT screen at the same time, not perfect,

CodePudding user response:

Upstairs if not, through a button, it is concluded that table display and EDIT screen at the same time, not perfect,
I am using is FireMonkey HD form, no DBEdit, only Edit, I change all the DBEdit Edit, if not, there is an error,

CodePudding user response:

The fifth floor, please see the following:

Many mistakes,

CodePudding user response:

refer to 6th floor u011443248 response:
upstairs if not, through a button, draw a table display and EDIT screen at the same time, not perfect,

What's the matter, screening out again?

CodePudding user response:

refer to the eighth floor u011443248 response:
5 floor, please see the following:

Many mistakes,

According to the version of the controls you use attribute change is ok,

CodePudding user response:

Victory is in sight, poor data binding, the last line of code, how to change??????

CodePudding user response:

The Edits. The DataSource:=self. DataSource1;
This line in FireMonkey HD mode, if change? The above code available under a line into FM? Who knows?

CodePudding user response:

The Edits. Holding:=self. DataSource1;
This also not line!
  • Related