Jump to content

How to check asp deleted record.


Recommended Posts

I want to show an error if orderid not found.I used this code, but! it's not working.Am i doing something wrong?

<%call ConnectionsqlText  = "delete from orders where orderid='123'"set objRs = server.CreateObject("adodb.recordset")If Not isNull(objRs) Then	objRs.ActiveConnection = objConn	objRs.Source = sqlText	objRs.open ,,3,3	response.Write("Record Deleted.")else	response.Write("Record Not Found.")end ifCall CloseConnection%>

Link to post
Share on other sites

Your code is checking if the recordset object you just created (but haven't opened) is null, not if a certain record exists in the database. You can do a select before the delete to see if you can select the record with that ID.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...