I need a fresh pair of eyes for a problem I'm having. I'm trying to update remote tables using a ZQuery and a ZUpdateSQL component. I want to use one ZQuery and a ZUpdateSQL for each of the tables that I want to update. I have 8 tables to update.
The code snippet for updating one of the tables is shown below:
Code: Select all
with qryWrite do
begin
//
SQL.Clear;
try
UpdateObject := updFoyerTable;
if LFoyerRecord[0].ID = 0 then
UpdateObject.SQL[ukInsert].Text := SQLInsertFoyerRecord
else
UpdateObject.SQL[ukModify].Text := SQLModifyFoyerRecord;
ApplyUpdates;
Connection.Commit;
// set the operation results to 'success'
strOperationFlag := strServerUpdateRecordSuccess;
except
// rollback the transaction because it failed!
Connection.Rollback;
// set the operation results to 'failure'
strOperationFlag := strServerUpdateRecordFailure;
end;
// close the dataset
Close;
end;
The insert and modify SQL statements are as shown below:
Code: Select all
SQLInsertFoyerRecord = 'INSERT INTO Foyers' +
'(Nom, Adresse, VilleCodePostal, Telephone, Contact)' +
'VALUES (:Nom, :Adresse, :VilleCodePostal, :Telephone, :Contact)';
SQLModifyFoyerRecord = 'UPDATE Foyers SET' +
'Nom = :Nom, Adresse = :Adresse, VilleCodePostal = :VilleCodePostal, Telephone = :Telephone, Contact = :Contact' +
'WHERE pk_id_foyer = :ID';
What am I doing wrong? Any insight will be highly appreciated.
JD