Theos PowerBasic Museum 2017

Archive => Discussion - Legacy Software (PBWIN 9.0+/PBCC 5.0+) => Topic started by: Ian Bayly on March 15, 2009, 05:34:10 AM

Title: DAO and Delete recordset
Post by: Ian Bayly on March 15, 2009, 05:34:10 AM
José

In your example DAO: Delete record
http://www.jose.it-berater.org/smfforum/index.php?topic=2643.0
Only the current record is deleted (in this case the last record).
How would I amend this example such that the complete recordset is deleted?
Looking at ADO examples it appears that a modifier after the delete handles this, but I can't see anything similar for DAO in the inc files.

Ian B
Title: Re: DAO and Delete recordset
Post by: José Roca on March 15, 2009, 03:51:46 PM
 
DAO's Delete method has not parameters. You will need to use a loop using MoveFirst and Delete until there are not records in the recordset.
Title: Re: DAO and Delete recordset
Post by: Matt Humphreys on March 15, 2009, 07:42:13 PM
Have you considered (I may be completely off point with what you are trying to achieve here)...

SqlStr = UCODE$("DELETE * FROM Authors")
pDatabase.Execute(SqlStr)
Title: Re: DAO and Delete recordset
Post by: Ian Bayly on March 16, 2009, 03:22:03 AM
Thank you both for your responses.
Matt your code is exactly what I need, I couldn't find an example showing the execute SQL instruction.

Again - thanks.

Ian B