Delete only ONE row

Results 1 to 3 of 3

Thread: Delete only ONE row

  1. #1
    Thomas A Guest

    Default Delete only ONE row

    When I use the command DELETE FROM ..., all rows that are matching the criteria are deleted. But what if there are many identic rows and if I just want to delete one of them, for exemple the row number ## in the table (I know this number) ? I tried the command Recordset.Delete but I get an error using it.<BR>Does anyone know how to do that ?<BR>Thanks

  2. #2
    Join Date
    Dec 1969

    Default RE: Delete only ONE row

    Open a recordset RS with your record (row) in it. Then use RS.Delete to delete whatever is in the recordset. I use RS.Update after that, but I&#039m not sure that is needed.

  3. #3
    Join Date
    Dec 1969

    Default better way, w/ sql

    here&#039s a better way to do it, using sql...and if you know the row&#039s identification number (i&#039m assuming this is an autonumber field...if it is not, i highly suggest you put one in NOW)<BR><BR> "delete * from mytable where autonumberfield = 7"<BR>&#039 7 is just a dummy<BR><BR>now, if you had this number created on the fly, like, passed through a querystring it would look something like this:<BR><BR>mynumber=request.querystring("mynumbe r")<BR> "delete * from mytable where autonumberfield=" & mynumber<BR><BR>hope this helps!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts