Interesting behaviour

From: Gary Wardell (nospam_at_sample.com)
Date: 11/29/03


Date: Fri, 28 Nov 2003 20:03:56 -0500

Hi,

I understood that the Free method was used to release all resources used by
an object and return it to it's original state.

However, when I did Free on an ADO connection and subsequently did this to
test if the connection was already created and open:

   If adoDataCn is TAdoConnection Then Exit;

It passed then test, even thought it was closed and freed!

I found that doing:

  adoDataCn := Nil;

Would then fail the IF test and let the connection be reopened.

What is the preferred way to restore and object to it's initial unallocated
state?

In VB it was to do:

  adoDataCn.Close
  Set adoDataCn = Nothing

Do I need to do this in Pascal?

  adoDataCn.Close;
  adoDataCn.Free;
  adoDataCn := Nil;

Gary