J
jasonzhaoyam
Unregistered / Unconfirmed
GUEST, unregistred user!
[blue]请各位大虾帮帮小弟!!!!以下的程式代码,以for循环得出的字符串为条件从产品数据库中查出数据,假如我用固定的字符串IDD:='''10'''+','+'''11'''+','+'''13'''代进去只能查出以10、11、13为条件的三条记录,请问如何能用循环得邮的字符串代进去呢?或者用其它的方法也行,只要能查出来。[/blue]
procedure TForm1.Button2Click(Sender: TObject);
var str,aa,bb:string;
i: integer;
begin
str:='';
for i:=0 to Memo1.Lines.Count -1do
begin
str:=''''+str+''''+''''+Memo1.Lines.Strings+''''+',';
end;
i:=i+1;
System.Delete(str,Length(str),2);
//bb:=copy(str,i+1,i+100);
query3.Close;
query3.SQL.Clear;
//IDD:='''10'''+','+'''11'''+','+'''13''' ;
str1:='select * from 产品 where 产品ID in ('+IDD+')';
query3.SQL.Add(str1);
query3.Open;
dbgrid1.datasource:-datasource;
end;
procedure TForm1.Button2Click(Sender: TObject);
var str,aa,bb:string;
i: integer;
begin
str:='';
for i:=0 to Memo1.Lines.Count -1do
begin
str:=''''+str+''''+''''+Memo1.Lines.Strings+''''+',';
end;
i:=i+1;
System.Delete(str,Length(str),2);
//bb:=copy(str,i+1,i+100);
query3.Close;
query3.SQL.Clear;
//IDD:='''10'''+','+'''11'''+','+'''13''' ;
str1:='select * from 产品 where 产品ID in ('+IDD+')';
query3.SQL.Add(str1);
query3.Open;
dbgrid1.datasource:-datasource;
end;