Subject Error codes
Author Dion Oliphant
Hi All,

Could someone please point me in the right direction. Am I using IBO
correctly?
Is the structure correct, and how do I get hold of the error codes(except on
...)?
Would I also need to check for concurrency here?

if ibDataSource.Dataset = ibGradesQry then
begin

if not ibGradesTrans.InTransaction then
ibGradesTrans.StartTransaction;

try
ibGradesQry.Insert;
ibGradesQry.FieldByName('GradeName').AsString :=
edtDescription.Text;

if ibDataSource.Dataset.State in [dssEdit, dssInsert] then
ibDataSource.Dataset.Post;

{ Commit now. If successful, the node can be drawn. }
if ibGradesTrans.InTransaction then ibGradesTrans.Commit;

{ Add Node to tree. }
NewNode := AddTreeNode(PupilForm.tvGradeTree,
PupilForm.tvGradeTree.Selected,
ibGradesQry.FieldByName('GradeRef').AsInteger,
ntLearner, edtDescription.Text);

except on ibGradesTrans.????? // Need to pick up possible errors
from the commit here
{ Could also check here for an exception when the node was
drawn. }
if ibGradesTrans.InTransaction then ibGradesTrans.RollBack;
end;

end;

Thanks,
Dion