[dba-SQLServer] Delete

Michael Maddison michael at ddisolutions.com.au
Tue Aug 9 02:20:09 CDT 2011


Ok, the plot thickens :-)
So you only want to remove the rows from the recordset not the
underlying data?
To disconnect the ADO  recordset from the database you set the
connection to nothing, after loading the recordset.
You will have to trial and error to see what type of recordset you need,
snapshot won't work as you have discovered.
I havn't used access as a FE for years so others might want to chip
in???

Cheers

Michael M


-----Original Message-----
From: dba-sqlserver-bounces at databaseadvisors.com
[mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Wil
Wakely
Sent: Tuesday, 9 August 2011 3:48 AM
To: Discussion concerning MS SQL Server
Subject: Re: [dba-SQLServer] Delete

Thanks for reply, MIchael.

>Why not just open the recordset sorted and loop 5 times deleting as you
go? I'm not sure but I seem to recall you don't need to movenext if you
are deleteing.

Like this?

'select rs and order by date
strsql1 = "SELECT * FROM rs WHERE player=1 ORDER BY playdate ASC
DoCmd.runsql strsql1 rs.movefirst

for n = 1 to 5
  rs.delete
next n

rs.update

Woops! I just read that a snapshot RS cannot be edited. I don't want to
modify the underlying table so I used snapshot rs. Is there another way
to play with the data in the table without modifying the underlying
table?
--
===wil wakely
sunny san diego ca
_______________________________________________
dba-SQLServer mailing list
dba-SQLServer at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/dba-sqlserver
http://www.databaseadvisors.com


-----
No virus found in this message.
Checked by AVG - www.avg.com
Version: 10.0.1391 / Virus Database: 1520/3820 - Release Date: 08/07/11




More information about the dba-SQLServer mailing list