MEGA Search
20.3 Million


Sign Up
From: Peter Tickler  
Subject: Deleting records from TADOTable
NewsGroup: borland.public.delphi.database.ado
Date Posted: 12-Jul-2005 at 6:54:12 PST
I am trying to delete all records from a TADOTable. I am using the following line of code:

tblInvoices.DeleteRecords(arAll);

But it gives an error message: "Operation is not allowed in this context".

Any idea what might be causing this?



From: Peter Tickler  
Subject: Re: Deleting records from TADOTable
NewsGroup: borland.public.delphi.database.ado
Date Posted: 14-Jul-2005 at 2:12:13 PST
Brian Bushay TeamB  wrote:

>Unfortunately Microsoft never implemented that option for DeleteRecords.
>You will need to use a Delete query.
>--
>Brian Bushay (TeamB)
>Bbushay@NMPLS.com

Thanks. I have done it as you suggest.

Peter

From: Brian Bushay TeamB  
Subject: Re: Deleting records from TADOTable
NewsGroup: borland.public.delphi.database.ado
Date Posted: 12-Jul-2005 at 22:4:57 PST
>I am trying to delete all records from a TADOTable. I am using the following line of code:
>tblInvoices.DeleteRecords(arAll);
>But it gives an error message: "Operation is not allowed in this context".
>Any idea what might be causing this?

Unfortunately Microsoft never implemented that option for DeleteRecords.
You will need to use a Delete query.
--
Brian Bushay (TeamB)
Bbushay@NMPLS.com

From: Charles Collins  
Subject: Re: Deleting records from TADOTable
NewsGroup: borland.public.delphi.database.ado
Date Posted: 12-Jul-2005 at 10:11:19 PST
DeleteRecords does not work.  Use a Command component.  See my message from 
7/1 about the same problem, message subject "Operation is not allowed in 
this context".

"Peter Tickler"  wrote in message 
news:42d3cb84$1@newsgroups.borland.com...
>
> I am trying to delete all records from a TADOTable. I am using the 
> following line of code:
>
> tblInvoices.DeleteRecords(arAll);
>
> But it gives an error message: "Operation is not allowed in this context".
>
> Any idea what might be causing this?
>
>
Add a component like:    MyCmd: TADOCommand;

Instead of using the DeleteRecords, use a routine like this:

        CabInfo.Active := true;

        MyCmd.CommandText := 'Delete * from CabInfo';
        MyCmd.Execute;

        CabInfo.Active := false;

where CabInfo is your table name.