Board index » delphi » BeforePost Abort record Positioning problem

BeforePost Abort record Positioning problem


2005-12-03 09:55:47 PM
delphi85
I'm handling a special situation where I need to call my own custom delete
procedure from the BeforeDelete event of a TADODataSet, and in the procedure
I'm calling a stored procedure to delete a group of records in the backend.
Just after the call to my delete procedure in the BeforeDelete event I issue
an 'abort' which stops the dataset from deleting the records (but of course
the records ARE deleted via my custom procedure). In my code just after the
stored procedure is called I refresh the dataset so that the deleted records
are removed, and I locate the record that follows the last deleted record.
Hope this is clear so far.
If the user chooses to delete the records from a menubar onclick event that
calls my custom delete procedure, everything is fine and the record is
positioned correctly. If the user presses the delete key, no matter what my
code does, the dataset always goes to the first record in my grid.
Thanks in advance for any suggestions.
 
 

Re:BeforePost Abort record Positioning problem

I'm using a DevExpress grid - My code is locating the record after the
delete via grid methods, and I am just thinking that it might be better to
determine the record to focus on based on the ado dataset, rather than the
grid, and then after the delete locate that record in the dataset. Maybe
that makes more sense, and will eliminate the problems I am having. I will
try some tests to see if the problem is handled and will post my results.
Thanks.
"Brian Bushay TeamB" <XXXX@XXXXX.COM>writes
Quote

>the records ARE deleted via my custom procedure). In my code just after
>the
>stored procedure is called I refresh the dataset so that the deleted
>records
>are removed, and I locate the record that follows the last deleted record.
>
>Hope this is clear so far.
>
>If the user chooses to delete the records from a menubar onclick event
>that
>calls my custom delete procedure, everything is fine and the record is
>positioned correctly. If the user presses the delete key, no matter what
>my
>code does, the dataset always goes to the first record in my grid.

Posting the code you use for the refresh and locate might help us.
--
Brian Bushay (TeamB)
XXXX@XXXXX.COM