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 recordsCodePudding 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: