HungryMind 0 Posted April 14, 2011 Report Share Posted April 14, 2011 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%> Quote Link to post Share on other sites
justsomeguy 1,135 Posted April 14, 2011 Report Share Posted April 14, 2011 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. Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.