如果要查中文的,对输入的内容有要求,比如用','号分隔:
var
s : string;
str : string;
i : integer;
begin
i := length(trim(edit1.text));
s := trim(edit1.text);
if copy(s, length(s), 1) = ',' then s := copy(s, 1, length(s) - 1);
str := '';
while pos(',', s) > 0 do
begin
str := str + '''' + copy(s, 1, pos(',', s) - 1) + ''',';
s := copy(s, pos(',',s) + 1, length(s) - pos(',', s) - 1);
end;
str := 'select * from name where name in (' + str + '''' + s + ''')';
with form1.query1 do
begin
close;
sql.clear;
sql.add(str);
open;
end;
end;