Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: Cannot perform on closed dataset


This question is answered.


Permlink Replies: 2 - Last Post: Mar 29, 2018 6:46 AM Last Post By: Michael Sawyer ...
Barry Wood

Posts: 73
Registered: 9/3/01
Cannot perform on closed dataset  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Mar 20, 2018 8:18 AM
Hi,
I have a simple dbgrid that shows records from a Firedac query (fdqEvents - to an MSSQL table). I also have a close button (to close the form), but when I press this button I get a message 'fdqEvents: Cannot perform this operation on a closed dataset'. I can open this form again and all works correctly.

The close button simply closes the form, nothing else, and I've no extra information that points me to what is occurring that would generate this message. Certainly I have no code that closes this query, so I'm a little confused as to why I'm getting this message.

Any thoughts?
Barry Wood

Posts: 73
Registered: 9/3/01
Re: Cannot perform on closed dataset  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Mar 20, 2018 11:24 AM   in response to: Barry Wood in response to: Barry Wood
I need to add some extra to the above issue. I have 2 buttons on the main form, one to set the database to a test version, the other to a Live database. The code I use is this:

procedure TfPGCMain.btnLIVEClick(Sender: TObject);
begin
//Live button pressed, set up Live fdc ...
dm.fdc.Connected := False;
dm.fdc.ConnectionDefName:= 'FastHostsLive';
dm.fdc.Connected := True;

ConnectAllTables;
end;

This is for Live data. The other is similar but connection name point to the test Server.

Whenever I press either of these I also get the same error message, saying 'Cannot perform the operation on a closed dataset'. No matter how I go through the debugger I can't get to any line in my code that might indicate why this is a problem, so I'm stumped as to where to look.
Michael Sawyer ...

Posts: 9
Registered: 9/10/17
Re: Cannot perform on closed dataset
Correct
Click to report abuse...   Click to reply to this thread Reply
  Posted: Mar 29, 2018 6:46 AM   in response to: Barry Wood in response to: Barry Wood
Barry Wood wrote:
Hi,
I have a simple dbgrid that shows records from a Firedac query (fdqEvents - to an MSSQL table). I also have a close button (to close the form), but when I press this button I get a message 'fdqEvents: Cannot perform this operation on a closed dataset'. I can open this form again and all works correctly.

The close button simply closes the form, nothing else, and I've no extra information that points me to what is occurring that would generate this message. Certainly I have no code that closes this query, so I'm a little confused as to why I'm getting this message.

Any thoughts?

So you aren't closing any FDquerys on your Close button right?
Can you please provide code of the OnClick-event of the button?
Do you have a OnClose-Event on your form maybe?
Do you even have code in your form where you close one or more FDqueries at all?
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02