October 15th, 2013, 04:44 PM
Delete Multiple Selected Records From TDBAdvGrid
I am trying to delete multiple records selected via checkbox at TDBAdvGrid. My Code is as follows
It is deleting only first record in lineup. After deleting first record it breaks for loop and control goes back to TDBAdvGrid with updated data after delete.
procedure TForm5.Button3Click(Sender: TObject);
j := 0;
for i := 1 to DBAdvGrid1.RowCount - 1 do
if DBAdvGrid1.GetCheckBoxState(1,i,state) then
if state then
idn := StrToInt(DBAdvGrid1.Cells[6,i]);
UniQuery1.SQL.Text := 'Delete from userplays where id = :id';
UniQuery1.ParamByName('id').AsInteger := idn;
How to delete multiple records ?