全部博文(788)
分类:
2008-10-20 10:36:23
你这个问题好像没什么好办法,
这样做吧,
Function GetDelReocrdsID: string;
var
midStr,ResultStr:string;
begin
with adodataset do
begin
if active then active:=false;
commandtext:='select * from EMP order by [Name] asc' ; // 一定要排序
open; midStr:=''; ResultStr:='';
while (Not eof) do
begin
if trim(midstr)=trim(FieldByName('Name').asstring) then
ResultStr:=ResultStr+FieldByName('ID').asstring+',';
else midStr:=FieldByName('Name').asstring;
Next;
end;
if result<>'' then
result:=Copy(ResultStr1,length(ResultStr)-1)
else result:='-1'
Close;
end;
end;
procedure deleteSelectRecord;
begin
with Adocommand do
begin
commandtext:='Delete From EMP where ID in ('+GetDelReocrdsID+')';
execute;
end;
end;