Bonjour
Je développe une application sous Delphi6 que je connecte à Interbase 6.5.
J'ai créé un DataModule avec
* TIBDatabase (le test de connexion est bon)
* TIBTransaction
* TIBSQL
Mon but est de faire des SELECT, UPDATE, ....
Voici mon code :
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
| Procedure TDM.UpdateMatable(MaChaine : String);
Const
cMaRequeteUpdate = 'UPDATE Table1 SET Col1=%S';
begin
With TIbSQL1.Create(nil) do
begin
try
Database := IBDB;
Transaction := TibTransaction.Create(Self);
Transaction.StartTransaction;
SQL.Text := Format(cMaRequeteUpdate, [MAChaine]);
try
ExecQuery;
Transaction.Commit;
Except
On E:Exception do
begin
ShowMessage('UpdateMatable ' + #13 + e.message);
if Transaction.InTransaction then
Transaction.RollBack;
end;
end;
finally
Free;
end;
end;
end; |
Et là, j'ai une erreur EAccessViolation à l'exécution de la ligne
With TIbSQL1.Create(nil) do
Je ne m'en sors pas, quelqu'un a une idée ?
Partager