Clientdataset closing after opening

Asked

Viewed 503 times

0

I’ve been using Iphi xe6 for a few days now and I’m racking my brain with a problem. I have here the trio: Sqldataset -> Clientdataset -> Datasetprovider.

When I open my application, I call cdsPessoas.Open (Clientdataset).

So far so good, it displays my records all right. But at the time I call the cdsPessoas.Append, it returns me the error saying that Clientdataset is not active. The problem is that at no time I close it, IE, I do not know why the hell it is closing alone.

I use these components within a data module along with two more Clientdataset and Sqldataset doing the Master Detail. I tried to take the master Detail, but it’s not the problem, because the data is displayed correctly.

Does anyone have any idea what it might be?

  • Transcribing the user comment @Ewerton-Dutra, "It would be good if you passed part of the code, because you’re saying you’re not closing. But maybe you’re doing something that’s closing."

  • Update the question with a little code. But by the symptoms shown, I would say that a Open in the cdsPessoas before the Append would solve... Using components from a Data Module, as well as a designed form, generate several problems by hiding the code. It is difficult to be sure of property values when starting execution.

1 answer

3


Considering the information provided, I am not able to point out a direct answer to the problem, so I will try to help in another way, with an idea.

In situations like this what I do is compile the application with Debug Dcus active and put an event handler, in this case, in Afterclose of the Dataset in question. Then recreate the problem situation and when Delphi stops at breakpoint I value the Callstack, that in that case will show the entire sequence of calls that culminated in the situation.

Usually I find a code of my own, an event handler who had forgotten or even a bug who’s in charge of the case. Sometimes it is a normal component behavior that I had not understood well or else the use of a property in the wrong way.

Be that as it may, with the Callstack I can usually understand what’s causing the strange behavior and solve the case.

Try!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.