Subject Re: Exiting gracefully from lost connection error (335544721)
Author almfgingras
--- In, "Adam" <s3057043@y...>
> I am not suggesting you nullify con or trans here, but rather after
> explicitly committing or rollback of the transaction(s), and
> explicitly closing the connection, set
> con.DefaultTransaction := null;
> tran.DefaultConnection := null;
> This does not free the object, but rather means when you do free
> the object (which will happen when you free the owner form or
> datamodule), the component will not attempt to access the other
> component, which was obviously already freed.
Thanks for straighting this out for me, I misunderstood what you
were originally suggesting. I will try to untie the Database,
Connection and Transaction objects from each other and see what

> > For the time being, I think I will stick with Terry's suggestion
> > to use ExitProcess(0) instead of Application.Terminate, which
> > seems to very well address the problem to a certain degree.
> It doesn't really address the problem, it just aborts it. I imagine
> that the OS will eventually take care of the memory space, but you
> may retain other handles and open files for a lot longer.
I agree with you, it may not be the cleanest way to exit the
application, but since losing the network connection is (or should
be) a fairly rare situation, I think it may be acceptable to a
certain degree. Until I find a more appropriate solution that works,
I think it is at least better than getting the 'Send error to
Microsoft' prompt each time this situation occurs.

Many thanks again for your help,