RefreshDetail is causing exception (Unidac 6.1.4)
-
- Posts: 451
- Joined: Wed 19 Jan 2005 09:59
RefreshDetail is causing exception (Unidac 6.1.4)
Hello,
RereshDetails is causing exception:
"Can not perform this operation on a closed dataset"
Here is a call stack
:7600812f KERNELBASE.RaiseException + 0x54
:005e0cbc DatabaseError + $64
:005f2f26 TDataSet.CheckActive + $36
:00b8fead TCustomDADataSet.CheckActive + $5
:00b94f3a TCustomDADataSet.RefreshDetail + $1E2
I'll try to make a simple reproducible project. Are you aware of the problem ?
RereshDetails is causing exception:
"Can not perform this operation on a closed dataset"
Here is a call stack
:7600812f KERNELBASE.RaiseException + 0x54
:005e0cbc DatabaseError + $64
:005f2f26 TDataSet.CheckActive + $36
:00b8fead TCustomDADataSet.CheckActive + $5
:00b94f3a TCustomDADataSet.RefreshDetail + $1E2
I'll try to make a simple reproducible project. Are you aware of the problem ?
Last edited by swierzbicki on Wed 01 Jul 2015 06:54, edited 2 times in total.
Re: VirtualTable is causing exception when calling CheckActive
Hello,
This is a correct error, since it is raised in the TDataSet.CheckActive base method in the standard module DB if the DataSet is dsInactive.
This is a correct error, since it is raised in the TDataSet.CheckActive base method in the standard module DB if the DataSet is dsInactive.
-
- Posts: 451
- Joined: Wed 19 Jan 2005 09:59
Re: RefreshDetail is causing exception (Unidac 6.1.4)
But I never call "CheckActive" ! This is a project that used to worked... and moving from one record to another one raise this error.
Was there any modification with details dataset handling ?
Was there any modification with details dataset handling ?
Last edited by swierzbicki on Thu 02 Jul 2015 06:56, edited 2 times in total.
-
- Posts: 451
- Joined: Wed 19 Jan 2005 09:59
Re: RefreshDetail is causing exception (Unidac 6.1.4)
I've stepped into the code and error appears in
This behaviour was introduced in this version (First call is not present in previous release).
Removing it solves my problem. Is there a specific reason to call "First" ?
Code: Select all
TCustomDADataSet.RefreshDetail(Sender: TObject);
...
try
DoBeforeOpen;
DataReopen;
if Length(FIRecordSet.IndexFields) > 0 then
FIRecordSet.SortItems;
finally
Resync([]);
First; // <==== Exception because dataset is closed
DoAfterOpen;
end;
...
Removing it solves my problem. Is there a specific reason to call "First" ?
Re: RefreshDetail is causing exception (Unidac 6.1.4)
Yes, we have added a call for this method, however, it mustn't cause an error. Please send a small sample reproducing the issue to alexp*devart*com .
-
- Posts: 451
- Joined: Wed 19 Jan 2005 09:59
Re: RefreshDetail is causing exception (Unidac 6.1.4)
You can easily reproduce it :
Create a master/details relation.
On the OnBeforeOpen event of the detail dataset add something like that (in my case, i'm setting SQL script before opening any TUniQuery component) : TUniquery(Sender).Sql.Text := 'Select * from Table';
Demo sended to your email address
Create a master/details relation.
On the OnBeforeOpen event of the detail dataset add something like that (in my case, i'm setting SQL script before opening any TUniQuery component) : TUniquery(Sender).Sql.Text := 'Select * from Table';
Demo sended to your email address
Re: RefreshDetail is causing exception (Unidac 6.1.4)
You can't change the SQL text in the OnBeforeOpen event, since this leads to DataSet closing. You can use the BeforeRefresh event for this.
-
- Posts: 451
- Joined: Wed 19 Jan 2005 09:59
Re: RefreshDetail is causing exception (Unidac 6.1.4)
I don't understand why I cannot use the "BeforeOpen" event. This event occurs before an application executes a request to open a dataset, a dataset that is *already* closed. "BeforeRefresh" occurs immediately before an application refreshes the data in the dataset.
Most of my TUniQuery does refresh before / after modifying data... Some of the data are automatically refreshed... Using the "BeforeRefresh" event will definitively not be the right event to choose !
I don't have such errors when working with Master/Details TClientDatasets for exemple. I didn't get these issues whit previous Unidac release and for years now...
I guess that detail dataset linked event in this special case should'nt be triggered at all... Please review your point of view.
Thank you
Most of my TUniQuery does refresh before / after modifying data... Some of the data are automatically refreshed... Using the "BeforeRefresh" event will definitively not be the right event to choose !
I don't have such errors when working with Master/Details TClientDatasets for exemple. I didn't get these issues whit previous Unidac release and for years now...
I guess that detail dataset linked event in this special case should'nt be triggered at all... Please review your point of view.
Thank you
Re: RefreshDetail is causing exception (Unidac 6.1.4)
We will add a global variable responsible for this behavior, i.e. the BeforeOpen event will be called one time by default (on "real" opening DataSet), as well as in other DataSets.
-
- Posts: 451
- Joined: Wed 19 Jan 2005 09:59
Re: RefreshDetail is causing exception (Unidac 6.1.4)
That's nice. I suppose you will do the same for the other events ?
Re: RefreshDetail is causing exception (Unidac 6.1.4)
No, we won't change behavior for other events.