Salut à tous, mon problème est que j'arrive à supprimer une ligne d'un dbgrid mais pas plusieurs.
Alors je suis sur INTERBASE
Delphi 2010 FR
Voici ma procédure de suppression

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
 
procedure TForm1.btn1Click(Sender: TObject);
  Var
    i,K : Integer;
    N_Fact, Num_Bord, S  : string;
begin
  if Dialogs.MessageDlg('Confirmer la suppréssion des factures séléctioners ?',
    mtConfirmation, [mbAbort, mbYes], 0, mbYes) = mrYes then
  begin
    with dbgrd1 do
    begin
      I:= 1;
      while i<= SelectedRows.Count -1 do
        begin
          N_Fact := '';
          DataSource.DataSet.GotoBookmark(pointer(SelectedRows.Items[i])); // à cette ligne après de deuxième passage de la boucle erreur violation d'accès.
          N_Fact := DataSource.DataSet.FieldByName('N_Facture').Value;
          Try
            IBQuery1.SQL.Clear;
            IBQuery1.SQL.Add('Delete From ENTETEFACT where N_Facture = :N1');
            IBQuery1.Params.ParamByName('N1').Value := N_Fact;
            if not IbTransaction1.InTransaction
              then IbTransaction1.StartTransaction;
            IBQuery1.ExecSql;
            IbTransaction1.Commit;
            IBTransaction1.Active := True;
          except
          end;
          I := I + 1;
        end;
    end;
  end;
Merci