Home > Back-end >  I want to achieve in the delphi7 with multiple attributes of the same query, should be how to write
I want to achieve in the delphi7 with multiple attributes of the same query, should be how to write

Time:09-30

Procedure TForm19. Button1Click (Sender: TObject);
Var
I: integer;
Str1 str2, str3, SQLSTR: string;
The begin
Str2:=';
For I:=0 to GroupBox1. Do ControlCount - 1
The begin
If GroupBox1. Controls [I] is TCheckBox then
The begin
If TCheckBox (GroupBox1. Controls [I]), Checked then
The begin
The str1: str1=+ TCheckBox (GroupBox1 Controls [I]). The Caption;
end;
end;
If str1 & lt;> "' then
The begin
Str2:=str2 + '(select' + str1 + from books information maintenance group by '+ str1 +' having a count (' + str1 +) & gt; 1) the union ';
Str1:=';
end;
end;
Str3:=copy (str2, 1, length (str2) - 5).
For I:=0 to GroupBox1. Do ControlCount - 1
The begin
If GroupBox1. Controls [I] is TCheckBox then
The begin
If TCheckBox (GroupBox1. Controls [I]), Checked then
The begin
The str1: str1=+ TCheckBox (GroupBox1 Controls [I]). The Caption;
end;
end;
If str1 & lt;> "' then
The begin
break;
end;
end;

close;
Form10. Adoquery1. SQL. The Clear;
SQLSTR:='select * from books information maintenance where' + str1 + '(' + str3 +) in';
Form10. Adoquery1. SQL. The Add (SQLSTR);
Form10. Adoquery1. Open;
end;



Select properties from the table,

Forget the great god give guidance!

CodePudding user response:

Your GroupBox container contains the components?

CodePudding user response:

Set breakpoints, see SQLSTR value is how much, so that you become to analyze SQL statements, you know where a problem, see you write, SQL level should be pretty bad,
  • Related