I have a site that is used to track assets. On a details page there is a link to delete that record.
Right now it will delete the record right away. How can I prompt for comfirmation?
Here is the link to delete:
<a href="delete_entry.asp?ID=<% Response.write (rsAsset("ID"))%>">Delete This Asset</a> |
Here is the the "delete_entry.asp" page.
<% 'Dimension variables Dim adoCon 'Holds the Database Connection Object Dim rsDeleteEntry 'Holds the recordset for the record to be deleted Dim strSQL 'Holds the SQL query to query the database Dim lngRecordNo 'Holds the record number to be deleted
'Read in the record number to be deleted lngRecordNo = CLng(Request.QueryString("ID"))
'Create an ADO connection object Set adoCon = Server.CreateObject("ADODB.Connection")
'Set an active connection to the Connection object using a DSN-less connection adoCon.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("assets.mdb")
'Create an ADO recordset object Set rsDeleteEntry = Server.CreateObject("ADODB.Recordset")
'Initialise the strSQL variable with an SQL statement to query the database strSQL = "SELECT assets.* FROM assets WHERE ID=" & lngRecordNo
'Set the lock type so that the record is locked by ADO when it is deleted rsDeleteEntry.LockType = 3
'Open the recordset with the SQL query rsDeleteEntry.Open strSQL, adoCon
'Delete the record from the database rsDeleteEntry.Delete
'Reset server objects rsDeleteEntry.Close Set rsDeleteEntry = Nothing Set adoCon = Nothing
'Return to the delete select page in case another record needs deleting Response.Redirect "update_select.asp" %>
|