Board index » delphi » TDBNavigator & ADO cancel method

TDBNavigator & ADO cancel method

I am using a TDBNavigator, TADODataSet, DataSource and a DBGrid.

When I click the delete button on the navigator I can catch the BeforeAction
event
and try to cancel the delete action by using the following method

    DataSource1.DataSet.Cancel;

But it doesnt do anything the delete action still get actioned. Is there a
way to stop
a delete taking place? What component should handle the cancel request?

Thanks,

Kevin.

 

Re:TDBNavigator & ADO cancel method


Problem solved - simply Abort.

Quote
"Nemesis" <kevin@ns_balou.force9.co.uk> wrote in message

news:3aae3129_2@dnews...
Quote
> I am using a TDBNavigator, TADODataSet, DataSource and a DBGrid.

> When I click the delete button on the navigator I can catch the
BeforeAction
> event
> and try to cancel the delete action by using the following method

>     DataSource1.DataSet.Cancel;

> But it doesnt do anything the delete action still get actioned. Is there a
> way to stop
> a delete taking place? What component should handle the cancel request?

> Thanks,

> Kevin.

Re:TDBNavigator & ADO cancel method


IMHO you should call SysUtils.Abort function  but not Cancel method of
DataSet.

"Nemesis" <kevin@ns_balou.force9.co.uk> ???Y/???Y ?????
???Y??: news:3aae3129_2@dnews...

Quote
> I am using a TDBNavigator, TADODataSet, DataSource and a DBGrid.

> When I click the delete button on the navigator I can catch the
BeforeAction
> event
> and try to cancel the delete action by using the following method

>     DataSource1.DataSet.Cancel;

> But it doesnt do anything the delete action still get actioned. Is there a
> way to stop
> a delete taking place? What component should handle the cancel request?

> Thanks,

> Kevin.

Re:TDBNavigator & ADO cancel method


You should call Sysutils.Abort not Dataset.cancel in the beforedelete event.

Eduardo

Nemesis <kevin@ns_balou.force9.co.uk> escribi en el mensaje de noticias
3aae3129_2@dnews...

Quote
> I am using a TDBNavigator, TADODataSet, DataSource and a DBGrid.

> When I click the delete button on the navigator I can catch the
BeforeAction
> event
> and try to cancel the delete action by using the following method

>     DataSource1.DataSet.Cancel;

> But it doesnt do anything the delete action still get actioned. Is there a
> way to stop
> a delete taking place? What component should handle the cancel request?

> Thanks,

> Kevin.

Other Threads