<% Option Explicit %>

<% ' The first time this page is retrieved and any time it is ' submitted without being completely filled out, the form ' is displayed. If it is submitted and completely filled out ' the form is processed in the Else clause. If Trim(Request("Delete"))<>"DELETE" Then ShowHeader "Delete An Ad" Set Connect = Server.CreateObject("ADODB.Connection") Connect.Open "Classifieds" Set MyClass = Server.CreateObject("ADODB.Recordset") MyClass.Open _ "SELECT * FROM Items WHERE ItemNum=" & _ Request("ItemNum"),Connect ShowItem MyClass("Item"),MyClass("Description"),_ MyClass("Price"),MyClass("Phone"),_ MyClass("Email"),MyClass("State"),_ MyClass("Posted") %> If you are sure you want to delete this record, type the word DELETE in the edit below and click the Delete Record button to confirm.

">
Type DELETE:
<% Else %> <% Dim Query, Connect, MyClass, Place ShowHeader "Delete An Ad" 'On Error Resume Next Set Connect = Server.CreateObject("ADODB.Connection") Connect.Open "Classifieds" Set MyClass = Server.CreateObject("ADODB.Recordset") Query = "SELECT * FROM Items WHERE ItemNum=" & Request("ItemNum") MyClass.Open Query,Connect,adOpenDynamic,adLockOptimistic MyClass.Delete If Err.Number = 0 Then %>

Your classified ad has been deleted.

Home

<% Else %> There was an error deleting your ad.

Error #<%=Err.Number%>: <%=Err.Description%>

<% End If %> <% End If %>