check status of insert, delete, update,

Results 1 to 2 of 2

Thread: check status of insert, delete, update,

  1. #1
    yls Guest

    Default check status of insert, delete, update,

    Hi, say for insert,delete, update, after i perform these three statments on my sql query, and some conditions are met for example<BR>1) Insert<BR>1.1) duplicate records<BR><BR>2) Delete<BR>2.1) Record not existent<BR><BR>3) Update<BR>3.1) Update to a non existent record<BR><BR>For the above, how do we catch and notify the user about it. emm, I am sure that there are many other traps and errors as well. thanks

  2. #2
    Steve Cimino Guest

    Default RE: check status of insert, delete, update,

    Why not check it BEFORE it goes in??<BR><BR>IF EXISTS(SELECT &#039True&#039 FROM yourTable WHERE something=&#039something&#039)<BR>BEGIN --this means the record is already there<BR>--Do your update here<BR>SELECT &#039Updated&#039 --this returns "updated" to your ASP page<BR>END<BR>ELSE<BR>BEGIN<BR>--Do your &#039insert&#039 here<BR>SELECT &#039Inserted&#039<BR>END<BR><BR>This way, you can tell the user that you either added him, or updated his info, without making a second trip.

Posting Permissions

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