I have one fundamental doubt in Delphi. When I keep any component at design time, say for example TADOConnectuion and on button click even I write following code then I do not get any error:
begin
ADOConnection.Free; //No error
ADOConnection.Free; //No error
ADOConnection.Free; //No error
end;
But if I create the same object at run time as follwos I get "Access Violation..." error
begin
ADOConnection := TADOConnection.create(self);
ADOConnection.Free; //No error
ADOConnection.Free; //Getting an "Access Violation..." error
end;
I get the same error even though I create the object as below:
ADOConnection := TADOConnection.create(nil);
Just would like to know the reason behind such behaviour, i.e. why there is no error when I keep the component at design time ?