<% if session("admin") <> "TRUE" then response.redirect("../index.asp")%> <% ' *** Edit Operations: declare variables MM_editAction = CStr(Request("URL")) If (Request.QueryString <> "") Then MM_editAction = MM_editAction & "?" & Request.QueryString End If ' boolean to abort record edit MM_abortEdit = false ' query string to execute MM_editQuery = "" %> <% ' *** Delete Record: declare variables if (CStr(Request("MM_delete")) <> "" And CStr(Request("MM_recordId")) <> "") Then MM_editConnection = MM_workspace_STRING MM_editTable = "workspace_entity" MM_editColumn = "entity_id" MM_recordId = "" + Request.Form("MM_recordId") + "" MM_editRedirectUrl = "../thanks.asp?action=deleteEntity" ' append the query string to the redirect URL If (MM_editRedirectUrl <> "" And Request.QueryString <> "") Then If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0 And Request.QueryString <> "") Then MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString Else MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString End If End If End If %> <% ' *** Delete Record: construct a sql delete statement and execute it If (CStr(Request("MM_delete")) <> "" And CStr(Request("MM_recordId")) <> "") Then ' create the sql delete statement MM_editQuery = "delete from " & MM_editTable & " where " & MM_editColumn & " = " & MM_recordId If (Not MM_abortEdit) Then ' execute the delete Set MM_editCmd = Server.CreateObject("ADODB.Command") MM_editCmd.ActiveConnection = MM_editConnection MM_editCmd.CommandText = MM_editQuery MM_editCmd.Execute MM_editCmd.ActiveConnection.Close ' ################################################################################################### ' Also Delete all the document records that reside under this entity and their associated documents. ' First we are going to have to set up a documents recordset and then loop through it. set RSdocuments = Server.CreateObject("ADODB.Recordset") RSdocuments.ActiveConnection = MM_workspace_STRING RSdocuments.Source = "SELECT * FROM workspace_documents WHERE entity_id = " & MM_recordId & "" RSdocuments.CursorType = 0 RSdocuments.CursorLocation = 2 RSdocuments.LockType = 3 RSdocuments.Open() RSdocuments_numRows = 0 ' Now set up the loop Dim Repeat1__numRows Repeat1__numRows = -1 Dim Repeat1__index Repeat1__index = 0 RSdocuments_numRows = RSdocuments_numRows + Repeat1__numRows ' Then for each valid entry delete the Associated File FIRST and then the records While ((Repeat1__numRows <> 0) AND (NOT RSdocuments.EOF)) myFileName = RSdocuments("filename") 'Create the FileSystemObject Dim objFSO Set objFSO = Server.CreateObject("Scripting.FileSystemObject") 'Delete the file objFSO.DeleteFile server.mapPath("../../images/uploaded/" & myFileName), True Repeat1__index=Repeat1__index+1 Repeat1__numRows=Repeat1__numRows-1 RSdocuments.MoveNext() Wend ' Finaly we get to delete the documents records MM_editQuery = "delete from workspace_documents where entity_id = " & MM_recordId Set MM_editCmd = Server.CreateObject("ADODB.Command") MM_editCmd.ActiveConnection = MM_editConnection MM_editCmd.CommandText = MM_editQuery MM_editCmd.Execute MM_editCmd.ActiveConnection.Close ' ################################################################################################### If (MM_editRedirectUrl <> "") Then Response.Redirect(MM_editRedirectUrl) End If End If End If %> <% Dim RSentity__MMColParam RSentity__MMColParam = "1" if (Request.QueryString("entity_id") <> "") then RSentity__MMColParam = Request.QueryString("entity_id") %> <% set RSentity = Server.CreateObject("ADODB.Recordset") RSentity.ActiveConnection = MM_workspace_STRING RSentity.Source = "SELECT entity_id, subject, subheading, myDate, author FROM workspace_entity WHERE entity_id = " + Replace(RSentity__MMColParam, "'", "''") + "" RSentity.CursorType = 0 RSentity.CursorLocation = 2 RSentity.LockType = 3 RSentity.Open() RSentity_numRows = 0 %> Delete Entity
Delete Entity

Are you sure that you want to delete the following entity?

WARNING - This will delete all documents that reside under this entity (You can NOT reverse this operation!).
<%=(RSentity.Fields.Item("subject").Value)%>
<%=(RSentity.Fields.Item("subheading").Value)%>
<%= DoDateTime((RSentity.Fields.Item("myDate").Value), 2, 2057) %>
<%=(RSentity.Fields.Item("author").Value)%>

">

 

<% RSentity.Close() %>