Procedure TForm1. Button2Click (Sender: TObject);
Var
I: integer;
The begin
With ADOQuery1 do
The begin
The Close;
SQL. The Clear;
SQL. The Add (' select distinct code from alldata where type='" + ComboBox2. Text + "' ");
The Open;
end;
For I:=0 to ADOQuery1. Do RecordCount - 1
The begin
ComboBox1. Items. The Add (ADOQuery1 fieldbyname (' code '). AsString) are identical.
ADOQuery1. Next;
end;
ComboBox1. ItemIndex:=0;
end;
CodePudding user response:
ComboBox1. Items. The clear;CodePudding user response:
A, a list of empty ComboBox
ComboBox1. Items. The clear;
Second, the list of the ComboBox, add characters
ComboBox1. Items. The Add (' characters');
Three, the choice of the empty ComboBox characters
ComboBox1. Text:=' ';
Procedure TForm1. Button2Click (Sender: TObject);
Var I: integer;
The begin
With ADOQuery1 do
The begin
The Close;
SQL. The Clear;
SQL. The Add (' select distinct code from alldata where type='" + ComboBox2. Text + "' ");
ComboBox2. Text:=' ';
The Open;
end;
ComboBox1. Items. The clear;
For I:=0 to ADOQuery1. Do RecordCount - 1
The begin
ComboBox1. Items. The Add (ADOQuery1 fieldbyname (' code '). AsString) are identical.
ADOQuery1. Next;
end;
ComboBox1. ItemIndex:=0;
end;
CodePudding user response: