🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.database.ado
3 messages
3 total messages Started by Andre Hayward Sun, 09 Oct 2005 15:32
DeleteRecords()
#604
Author: Andre Hayward
Date: Sun, 09 Oct 2005 15:32
32 lines
1894 bytes
Hi,

I'm trying to delete all the records in a single table with no
relations to any other table with

if (!dmWorks->ProgressRpt->IsEmpty())
{
  dmWorks->ProgressRpt->DeleteRecords(arAll);
}
but getting an error message "Operation is not allowed in this
context"

The error is the same whether you're using a TADOQuery, TADOTable or
TADODataSet

Nou helpfile says: use the Supports() function to find out whether the
datase will supports a delete but the supports function is a
conglomeration of enums and template functions and I can't figure out
how it should be coded.

In any case Supports() will not solve my problem.  I've also done the
Delete() function inside a loop for each record but all records are
for some reason not deleted and an error is not shown.

DELETE FROM PROGRESSRPT  returns an error "Command text does not
return a resultset" but in any case it works.  Maybe I should ignore
the error message and stick to SQL??

Any help will be appreciated.

Best Regards
Ander Hayward.
Re: DeleteRecords()
#606
Author: Viatcheslav V. Vassiliev
Date: Mon, 10 Oct 2005 06:33
46 lines
2529 bytes
DELETE FROM PROGRESSRPT is better that DeleteRecords(arAll). Use TADOCommand 
to execute this query, or TADOConnection.ExecuteCommand("..."), or 
TADOQuery.ExecSQL().

//------------------------------------------
Regards,
Vassiliev V. V.
http://www.managed-vcl.com - using .Net objects in Delphi for Win32 + 
ADO.Net
http://www.oledbdirect.com - The fastest way to access MS SQL Server,
MS Jet (Access) and Interbase (through OLEDB)

"Andre Hayward" <jorhaypi@mweb.co.za> ???????/???????? ? ???????? ?????????: 
news:gscik1lbmrhvc01v7cjnu8c4qecsk8qffi@4ax.com...
> Hi,
>
> I'm trying to delete all the records in a single table with no
> relations to any other table with
>
> if (!dmWorks->ProgressRpt->IsEmpty())
> {
>  dmWorks->ProgressRpt->DeleteRecords(arAll);
> }
> but getting an error message "Operation is not allowed in this
> context"
>
> The error is the same whether you're using a TADOQuery, TADOTable or
> TADODataSet
>
> Nou helpfile says: use the Supports() function to find out whether the
> datase will supports a delete but the supports function is a
> conglomeration of enums and template functions and I can't figure out
> how it should be coded.
>
> In any case Supports() will not solve my problem.  I've also done the
> Delete() function inside a loop for each record but all records are
> for some reason not deleted and an error is not shown.
>
> DELETE FROM PROGRESSRPT  returns an error "Command text does not
> return a resultset" but in any case it works.  Maybe I should ignore
> the error message and stick to SQL??
>
> Any help will be appreciated.
>
> Best Regards
> Ander Hayward. 
Re: DeleteRecords()
#607
Author: Mark Guerrieri
Date: Mon, 10 Oct 2005 19:05
9 lines
1072 bytes
>   dmWorks->ProgressRpt->DeleteRecords(arAll);
> }
> but getting an error message "Operation is not allowed in this
> context"
>

ADO's Recordset.Delete method only supports arCurrent.

Mark
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads