Database1.StartTransaction;
    try
       xsquery.ApplyUpdates; {try to write the updates to the database};
       Database1.Commit; {on success, commit the changes};
    except
       Database1.Rollback; {on failure, undo the changes};
    raise; {raise the exception to prevent a call to CommitUpdates!}
 
       xsquery.CommitUpdates; {on success, clear the cache}end;够详细了吧!!
xsquery  是query 的名字,