Registriert seit: 17. Jan 2007
418 Beiträge
Delphi 10 Seattle Professional
|
AW: Positionen Um-Sortieren
5. Jun 2011, 15:15
Habe es nun so gelöst:
Delphi-Quellcode:
begin
Table1.DisableControls;
for i := 0 to DBGrid2.SelectedRows.Count -1 do begin
DBGrid2.DataSource.DataSet.GotoBookmark(Pointer(DBGrid2.SelectedRows.Items[i]));
CurrPos := datamodule1.Table1.FieldByName('TourPos').AsInteger;
if CurrPos = 1 then begin
Table1.EnableControls;
exit;
end;
datamodule1.Table1.Edit;
datamodule1.Table1.FieldByName('TourPos').AsInteger := 9999;
datamodule1.Table1.Post;
datamodule1.Table1.FindKey([CurrPos - 1]);
datamodule1.Table1.Edit;
datamodule1.Table1.FieldByName('TourPos').AsInteger := Table1.FieldByName('TourPos').AsInteger + 1;
datamodule1.Table1.Post;
datamodule1.Table1.FindKey([9999]);
datamodule1.Table1.Edit;
datamodule1.Table1.FieldByName('TourPos').AsInteger := CurrPos - 1;
datamodule1.Table1.Post;
end;
Table1.EnableControls;
end;
Geändert von BBoy ( 5. Jun 2011 um 15:27 Uhr)
|