BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Deleting records from TADOTable

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (ADO)
View previous topic :: View next topic  
Author Message
Peter Tickler
Guest





PostPosted: Tue Jul 12, 2005 1:54 pm    Post subject: Deleting records from TADOTable Reply with quote




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?


Back to top
Charles Collins
Guest





PostPosted: Tue Jul 12, 2005 3:11 pm    Post subject: Re: Deleting records from TADOTable Reply with quote



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" <ptickler (AT) potato (DOT) org.uk> wrote

Quote:

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.



Back to top
Peter Tickler
Guest





PostPosted: Thu Jul 14, 2005 9:12 am    Post subject: Re: Deleting records from TADOTable Reply with quote




Brian Bushay TeamB <BBushay (AT) Nmpls (DOT) com> wrote:

Quote:
Unfortunately Microsoft never implemented that option for DeleteRecords.
You will need to use a Delete query.
--
Brian Bushay (TeamB)
[email]Bbushay (AT) NMPLS (DOT) com[/email]

Thanks. I have done it as you suggest.

Peter

Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (ADO) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.