求解:各位大神:delphi7中运用adoquery查询语句,怎么总是出现语法错误?代码如下:
procedureTForm14.Button2Click(Sender:TObject);beginclose;end;procedureTForm14.Button1...
procedure TForm14.Button2Click(Sender: TObject);beginclose;end;
procedure TForm14.Button1Click(Sender: TObject);vari:integer;str1,str2,str3,sqlstr:string;beginstr2:='';for i:=0 to GroupBox1.ControlCount-1 do begin if GroupBox1.Controls[i] is TCheckBox then begin if TCheckBox(GroupBox1.Controls[i]).Checked then begin str1:=str1+TCheckBox(GroupBox1.Controls[i]).Caption; end; end; if str1<>str2 then begin str1:=str1+','; str2:=str1; end; end; str3:=copy(str1,1,length(str1)-1); sqlstr:='select * from 书籍信息维护 where ('+str3+') in (select '+str3+' from 书籍信息维护 group by '+str3+' having count(*)>1)'; form10.adoquery1.SQL.Clear; form10.adoquery1.SQL.Add(sqlstr); form10.adoquery1.open; form13.Hide;end;
end.
当我在checkbox中选择两个属性的时候。就会出现这种状况!求解! 展开
procedure TForm14.Button1Click(Sender: TObject);vari:integer;str1,str2,str3,sqlstr:string;beginstr2:='';for i:=0 to GroupBox1.ControlCount-1 do begin if GroupBox1.Controls[i] is TCheckBox then begin if TCheckBox(GroupBox1.Controls[i]).Checked then begin str1:=str1+TCheckBox(GroupBox1.Controls[i]).Caption; end; end; if str1<>str2 then begin str1:=str1+','; str2:=str1; end; end; str3:=copy(str1,1,length(str1)-1); sqlstr:='select * from 书籍信息维护 where ('+str3+') in (select '+str3+' from 书籍信息维护 group by '+str3+' having count(*)>1)'; form10.adoquery1.SQL.Clear; form10.adoquery1.SQL.Add(sqlstr); form10.adoquery1.open; form13.Hide;end;
end.
当我在checkbox中选择两个属性的时候。就会出现这种状况!求解! 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询