% 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_documents" MM_editColumn = "document_id" MM_recordId = "" + Request.Form("MM_recordId") + "" MM_editRedirectUrl = "../thanks.asp?action=deleteDocument" ' 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 '############################# DELETE THE DOCUMENT FILE ############################################## myFileName = request.querystring("filename") 'Create the FileSystemObject Dim objFSO Set objFSO = Server.CreateObject("Scripting.FileSystemObject") 'Delete the file objFSO.DeleteFile server.mapPath("../../images/uploaded/" & myFileName), True '##################################################################################################### If (MM_editRedirectUrl <> "") Then Response.Redirect(MM_editRedirectUrl) End If End If End If %> <% Dim RSDocument__MMColParam RSDocument__MMColParam = "1" if (Request.QueryString("document_id") <> "") then RSDocument__MMColParam = Request.QueryString("document_id") %> <% set RSDocument = Server.CreateObject("ADODB.Recordset") RSDocument.ActiveConnection = MM_workspace_STRING RSDocument.Source = "SELECT document_id, title, filename, fileSize FROM workspace_documents WHERE document_id = " + Replace(RSDocument__MMColParam, "'", "''") + "" RSDocument.CursorType = 0 RSDocument.CursorLocation = 2 RSDocument.LockType = 3 RSDocument.Open() RSDocument_numRows = 0 MM_editAction = MM_editAction & "&filename=" & RSDocument("filename") %>
Delete Document |
<% RSDocument.Close() %>