HungryMind Posted April 14, 2011 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%> Link to comment Share on other sites More sharing options...
justsomeguy Posted April 14, 2011 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. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.