Utilisation de TIBSQL, TIBTransaction et TIBQuery ?
Bonjour,
J'utilise les composants TIBSQL, TIBTransaction et TIBQuery et je souhaiterai avoir votre avis sur l'utilisation que j'en fais :
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 28 29 30 31 32 33
|
try
if not IBDatabase1.Connected then IBDatabase1.Connected := true;
IBQuery1.SQL.Clear;
IBQuery1.SQL.Add('SELECT * FROM xxx');
IBQuery1.Open;
IBQuery1.First;
while not IBQuery1.Eof do
begin
if IdFTP1.Size(Path) <> -1 then
begin
try
IBSQL1.SQL.Clear;
IBSQL1.SQL.Add('INSERT INTO xxx');
IBSQL1.ExecQuery;
except
on E : Exception do
begin
Log(E.Message);
Log('SQL : ' + IBSQL1.SQL.Text);
end;
end;
end;
IBQuery1.Next;
end;
IBQuery1.Close;
except
on E : Exception do
begin
Log(E.Message);
MessageDlg(E.Message, mtError, [mbOK], 0);
end;
end; |
Le code a été volontairement simplifié afin de ne laisser que la partie qui nous interesse : base de données.
Pour IBDatabase1 :
Citation:
DefaultTransaction = IBTransaction1
LoginPrompt = False
SQLDialect = 1
Pour IBQuery1 :
Citation:
Database = IBDatabase1
Transaction = IBTransaction1
Pour IBTransaction1 :
Citation:
DefaultDatabase = IBDatabase1
Pour IBSQL1 :
Citation:
Database = IBDatabase1
Transaction = IBTransaction1
Merci,
MaTHieU_