Bonjour à tous,
J'utilise Firebird comme base de donnée avec Delphi 7.
J'ai une DBGrid dans laquelle j'ai plusieurs champs affichés avec des données, il est possible d'avoir deux lignes ou plus; complètemenet identique dans cette DBGrid.
Le problème est que quand je veux effacer une ligne, si cette ligne existe plusieurs fois, elles seront toutes effacer, or moi j'aimerai faire en sorte que seul la ligne que j'ai sélectionné soit effacer.
voici mon code
J'ai essayer de faire quelque chose avec l'instruction DECLARE ... CURSOR en SQL, mais ça ne marche pas.
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 with DataModule1 do begin IBQueryXPresta.Close; IBQueryXPresta.SQL.Clear; IBQueryXPresta.SQL.Add('DELETE FROM XPRESTA'); IBQueryXPresta.SQL.Add('WHERE XNUMCO = :NUMCO'); IBQueryXPresta.SQL.Add('AND XLIBELLE = :LIBELLE'); IBQueryXPresta.SQL.Add('AND XCODE = :CODE'); IBQueryXPresta.ParamByName('NUMCO').AsString := frmMain.dbtxtAVNUM.Field.Text; IBQueryXPresta.ParamByName('LIBELLE').AsString := XPrestaLibelle; IBQueryXPresta.ParamByName('CODE').AsString := XPrestaCode; IBQueryXPresta.Open; IBtrsXPresta.CommitRetaining; end;
Quelqu'un aurait-il une solution à me proposer?
Jeankiki
Partager