Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Dec 2004
    Location
    Jamaica
    Posts
    592
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Cool Did the Delete Sql Command work?

    del="DELETE FROM users WHERE user='" & admin & "'"
    Conn.execute del

    In the same way that I can check if a command or a record exists by checking if objRS.EOF is true, is there a way that I can check if the Delete command exists because it does not return an error if no record matches the criteria that was executed to be deleted!

    So how do I know that the operation was successful without having to do a SELECT FROM users WHERE username=blah blah and checking if the recordset is empty?

  • #2
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,074
    Thanks
    0
    Thanked 256 Times in 252 Posts
    Specify the optional second argument to the Execute method, it tells how many records are affected by the query.
    Code:
    dim ctr
    ctr = 0
    del="DELETE FROM users WHERE user='" & admin & "'"
    Conn.execute del, ctr
    if ctr = 0 then
      response.write "No record(s) deleted"
    end if
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________

  • #3
    Regular Coder
    Join Date
    Dec 2004
    Location
    Jamaica
    Posts
    592
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Post thanks!

    thanks man... works like a charm


  •  

    Posting Permissions

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