[thelist] ADO Delete Method

Ken Schaefer Ken at adOpenStatic.com
Wed Nov 10 18:01:42 CST 2004

Unless I'm missing something here, or you're not giving us the full details,
this type of code is *bad*. Why on earth are you running a SELECT statement
to return a bunch of records, and then doing nothing but deleting them?

Also, why do you insist on using "magic numbers" for your .Open call, but
then use named constants for other calls?

Can't you use a stored procedure to do this?

And also DELETE from the parent table first, then DELETE from the child


: -----Original Message-----
: From: thelist-bounces at lists.evolt.org
[mailto:thelist-bounces at lists.evolt.org] On
: Behalf Of Mark Kamian
: Sent: Thursday, 11 November 2004 9:52 AM
: To: thelist at lists.evolt.org
: Subject: [thelist] ADO Delete Method
: Hi all,
: I'm attempting to use the Delete Method's optional 'adAffectGroup' argument
: in the following code to delete all records in a recordset, but am getting
: this error:
: Error Type:
: ADODB.Recordset (0x800A0BB9)
: Arguments are of the wrong type, are out of acceptable range, or are in
: conflict with one another.
: listall.asp, line 16
: I should also include the fact that the SQL Query, when run directly in the
: DB, is fine and produces the intended records.
: If I use only the .Delete method, without the optional adAffectGroup
: argument, it works fine but only deletes the first record and not all of
: them.
: I've looked into the .Filter property, but haven't been able to get it
: yet...
: <%
: 'open connection code omitted for brevity...
: Set rsEdit = Server.CreateObject("ADODB.Recordset")
: If Request.QueryString("delete") = "OPENS" Then
: cmdTemp.CommandText = "SELECT OPENS.*, USERS.agt FROM OPENS
: rsEdit.Open cmdTemp, , 1, 3
: rsEdit.Delete adAffectGroup '(line 16)
: ElseIf
: yadayada...
: End If
: %>

More information about the thelist mailing list