Insertion dans une table avec IBDataSet
Bonjour,
J'utilise ce bout de code pour insérer des données dans une table (base de données interbase)
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
|
with DataModuleFrame1.IBDataSet1 do
begin
if not Locate('Libelle', self.libelle,[]) then
begin
try
if not Transaction.InTransaction then
begin
Transaction.StartTransaction;
end;
Append;
FieldByName('Libelle').AsString := self.libelle;
FieldByName('Description').AsString := self.description;
FieldByName('Date_Debut').AsString := self.date_creation;
Post;
Transaction.CommitRetaining;
Close;
open;
result := Lookup('Libelle', self.libelle, 'Id_Projet');
except on e:Exception do
Transaction.RollbackRetaining;
end;
end |
L'insertion avec des valeurs de champs vide. je n'ai pas pu trouver la cause de cela. J'ai affiché les valeurs de :
Code:
1 2 3
| FieldByName('Libelle').AsString;
FieldByName('Description').AsString;
FieldByName('Date_Debut').AsString; |
j'ai remarqué qu'il se mette à vide après l'instruction :
Merci d'avance.