MySQL Forums
Forum List  »  Delphi

free query if it exists
Posted by: Jim Sawyer
Date: November 20, 2019 08:35AM

Assume I have a query

dQuery := TFDQuery.Create( AConnection );
with dQuery do
begin
Connection := AConnection;
SQL.Add( 'Select * from MyTable' );
Open;
end;

This query may or may not have been opened at at time when I want to exit a procedure. If it has been created I want to

dQuery.Free;

However, if it has not been created, this last command will bomb.

Is there a procedure something like

if dQuery exists
dQuery.Free;

Please tell me what I need to replace the "if dQuery exists" with inorder to make "dQuery.Free" conditional on whether it exists or not.

Thank you,
Jim Sawyer

Options: ReplyQuote


Subject
Written By
Posted
free query if it exists
November 20, 2019 08:35AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.