TOracleDataSet Refresh problem

mlheureux

Member
Hi, I'm using DOA 3.4.6.4 with Delphi 5 and I have a weird problem.

I'm converting an application that used BDE into DOA and that application worked perfectly with the BDE. But I changed a TTable component for a TOracleDataSet, and now, whenever I hit the refresh button of my TDBNavigator, the TOracleDataSet refreshes, but goes back to the first record.

My TOracleDataSet's SQL is as follow :
SELECT TEMPLOYE.*, TEMPLOYE.RowID
FROM TEMPLOYE
ORDER BY No_employe

I tried adding 2 buttons to y interface, one which calls MyOracleDataSet.Refresh and the other class MyOracleDataSet.RefreshRecord.

The result is that the Refresh method lost the current record and goes back to the first record, while RefreshRecord works perfectly.

My guess is that the TDBNavigator (and also the TOracleNavigator) calls the Refresh method and that there's a bug in that method. But I'm new to DOA, so there may be something I don't understand correctly.

I have a solution to that. I can simply trap my navigator's BeforeAction and if the button is nbRefresh, I call the RefreshRecord function and abort. But don't like that solution much and would like to know if there's something I'm doing wrong and if there's something else I could do.

Thanks

Martin L'Heureux
 
u can use TBookmark before calling the refresh.
For eg:
x TBookmark //declarartion

x := TOracledataset.getBookmark
TOracledataset.refresh;
TOracledataset.gotobookmark(x);
TOracledataset.freebookmark(x);

I think Refreshrecord will refreshes only the current record and .Refresh will refreshes the whole record in the SQL Query. and after this,cursor(the position of TOracledataset) will come to the first record

Originally posted by mlheureux:
Hi, I'm using DOA 3.4.6.4 with Delphi 5 and I have a weird problem.

I'm converting an application that used BDE into DOA and that application worked perfectly with the BDE. But I changed a TTable component for a TOracleDataSet, and now, whenever I hit the refresh button of my TDBNavigator, the TOracleDataSet refreshes, but goes back to the first record.

My TOracleDataSet's SQL is as follow :
SELECT TEMPLOYE.*, TEMPLOYE.RowID
FROM TEMPLOYE
ORDER BY No_employe

I tried adding 2 buttons to y interface, one which calls MyOracleDataSet.Refresh and the other class MyOracleDataSet.RefreshRecord.

The result is that the Refresh method lost the current record and goes back to the first record, while RefreshRecord works perfectly.

My guess is that the TDBNavigator (and also the TOracleNavigator) calls the Refresh method and that there's a bug in that method. But I'm new to DOA, so there may be something I don't understand correctly.

I have a solution to that. I can simply trap my navigator's BeforeAction and if the button is nbRefresh, I call the RefreshRecord function and abort. But don't like that solution much and would like to know if there's something I'm doing wrong and if there's something else I could do.

Thanks

Martin L'Heureux

[This message has been edited by rinoshjoseph (edited 20 November 2002).]
 
Thanks for reply. I also thought about that solution, but I was just wondering if that was a bug, because the TDataSet doesn't react the same way.

And since I think both solutions (yours and mine) are *patching*, I wanted to know if there was something I didn't get right.

I think the problem is that the navigators call the Refresh method. I understand that Refresh fetches all record and goes back to the first while RefreshRecord only fetches the current record, but to me, there's something wrong there.

From my point of view, the Refresh method should go back to the current record OR the navigators should call RefreshRecord

Martin

Originally posted by rinoshjoseph:
u can use TBookmark before calling the refresh.
For eg:
x TBookmark //declarartion

x := TOracledataset.getBookmark
TOracledataset.refresh;
TOracledataset.gotobookmark(x);
TOracledataset.freebookmark(x);

I think Refreshrecord will refreshes only the current record and .Refresh will refreshes the whole record in the SQL Query. and after this,cursor(the position of TOracledataset) will come to the first record

[This message has been edited by rinoshjoseph (edited 20 November 2002).]
 
The Refresh function works as designed. It re-executes the query, and navigates to the first record.

I have logged an enhancement request to restore the current record.

------------------
Marco Kalter
Allround Automations
 
Back
Top