Link to home
Start Free TrialLog in
Avatar of Kifah Najem
Kifah Najem

asked on

Master Detail with TADODataset

Hi,
I am using delphi 2007 and oracle 12G database with EHLib DBGrid to create an application
I have a form with 2 EHDBGrid, the master and detail.
the problem, I am facing sometime "Object Was open" error message.
This error appear suddenly, and there is no way to make a certain steps to reproduce this error.
when I breakdown on debug mode, delphi dose not stop on a certain code.
But I noticed that this error happen when I am using Master-Detail link with ADODataset
I mean I mean I have 1 master ADODataset and Detail Dataset set it's datasource to the master.
When this error happen the detail ADODataset close, then I have to open it manually, then it will works fine.

So what I did, is to make it manual link for master detail. In this case the master and detail Dataset are independent.
So when I click on the master EhDBGrid, I run the query for the detail ADODataset...

Sure the onclick is not proper location to do such job, so I use the ADODataset onafterscroll event... but this cause another problem...

let me explain

on normal master detail link (using the datasource of the detail dataset), when you use the mouse wheel scroll, when you scroll, the detail will be loaded after the scrolling finish, and if you scroll slowly then the detail will be loaded for every one, as well when you scroll down fast and direct you make a click on the grid, the scrolling cancel and the selected row will load it's detail.

while
in the onafterscroll event, the detail will be loaded for every single row, and not when the scrolling finish, as well when I scroll down fast I can not cancel the scroll by clicking on the grid.

so I need to know how I can know when the scrolling of the grid finish, so I can then load the detail....

note: why I use this method... when the "Object was open" error occur, the detail dataset close, so manually loading the detail, will open it again, and the user will feel nothing.
ASKER CERTIFIED SOLUTION
Avatar of Thommy
Thommy
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Kifah Najem
Kifah Najem

ASKER

It looks good idea, I will give it a try
Hi,

Thank you, it is great idea and working just nice
You're welcome!

We've been using this TTimer solution for years and it really works fine.

Also thank you very much for the points.
:o))))))))))))))))))))