var tempAllId:string; i,j:integer; begin with dbgrid1.DataSource.DataSet do begin for i:=0 to dbgrid1.SelectedRows.Count-1 do begin GotoBookmark(pointer(DBGrid1.SelectedRows.Items[i])); for j := 0 to FieldCount-1 do begin if j>0 then tempAllId:=tempAllId+','; tempAllId:=tempAllId+fields[j].Text; end; end; end;