Home > Back-end > Edit control quantity according to query the field number and show how much... Please help modify co
Edit control quantity according to query the field number and show how much... Please help modify co
Time:10-12
Procedure TForm2. Button2Click (Sender: TObject); Var I: integer; SQLSTR: string; The begin ADOQuery3. Close; ADOQuery3. SQL. The Clear; ADOQuery3. SQL. The Add (' select * from sheet1 where AAA='" + trim (edit1. Text) + "' "); Adoquery3. Open; The SQLSTR:='; For I:=0 to ADOQuery3. Do FieldCount - 1 If ADOQuery3. Fields [I]. Text='is' then SQLSTR:=SQLSTR +', '+ ADOQuery3. Fields [I] FieldName. SQLSTR='select' SQLSTR: + + 'from sheet2 where AAA=' "+ ADOQuery3. Fieldbyname (" AAA"). AsString + "'" '; ADOQuery1. Close; ADOQuery1. SQL. The Clear; Adoquery1. SQL. The add (SQLSTR); Adoquery1. Open; end;
Procedure TForm2. Button3Click (Sender: TObject); Var I: integer; The begin For I:=0 to do adoquery1.Com ponentCount - 1 If (Components [I] is TEdit) and (TEdit (Components [I]). The Name [5] in [' 0 '... '4']) then TEdit (Components [I]). The Visible:=false; end; Remarks: the above adoquery3 is a line, the query in the sheet1 AAA is the bank in the cell for all "yes" column in the adoquery1 shows that if there are 100 column in the sheet1, and AAA cell "is" the field for five, BBB line cell "is" the field is nine, CCC line 12 cell is "yes",,,,,,, different for different fields, I think through the AAA finally query out five fields, the EDIT control will show Edit1 - Edit5, BBB query nine field, eventually will show Edit1 - Edit9, Edit1 - Edit9 corresponding BBB query column (column 1 to 9, How to modify it, thank you!
CodePudding user response:
Here as many technical staff less and less, nobody should send a post a lot of day, ah, good carry of the BBS is like this,,,?
CodePudding user response:
Adoquery1.Com ponentCount This is wrong, should read the whole window controls,