主题:  请帮我看一下错在那里?我就是不能删除文件夹里的文件!

sh5d

职务:普通成员
等级:1
金币:0.0
发贴:16
注册:2001/11/30 11:22:27
#12002/3/10 20:32:32
<%@LANGUAGE="VBSCRIPT"%>

<%
set rsnews = Server.CreateObject("ADODB.Recordset")
rsnews.ActiveConnection = MM_connazsys_STRING
rsnews.Source = "SELECT * FROM word"
rsnews.CursorType = 0
rsnews.CursorLocation = 2
rsnews.LockType = 3
rsnews.Open()
rsnews_numRows = 0
%>
<%
Dim Repeat1__numRows
Repeat1__numRows = -1
Dim Repeat1__index
Repeat1__index = 0
rsnews_numRows = rsnews_numRows + Repeat1__numRows
%>
<%
' *** 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_connazsys_STRING
MM_editTable = "word"
MM_editColumn = "id"
MM_recordId = "" + Request.Form("MM_recordId") + ""
MM_editRedirectUrl = "d2.asp"

' 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
%>
<%
'======================================
Function newFileSystemObject()
set newFileSystemObject=Server.CreateObject("Scripting.FileSystemObject")
End Function
%>
<%
Function fileExists(aFileSpec)
fileExists=newFileSystemObject.FileExists(aFileSpec)
End Function
'======================================
%>
<%
' *** 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
' This is where we delete the file before we delete the record!
' 在我们删除该文件记录在数据库中的信息之前先删除文件!
Set File = CreateObject("Scripting.FileSystemObject")
'图象的路径是:http://127.0.0.1/aaaaa/test
ImagePath = Server.MapPath("test\")
ImagePath = ImagePath & "\" &(rsNews.Fields.Item("word").value)
' check if file exists and if true delete the file
' 判断文件是否已经存在忡梧嬖蛏境淠?
If fileExists(ImagePath) Then
File.DeleteFile(ImagePath)
End If


    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
%>


Untitled Document




<%
While ((Repeat1__numRows <> 0) AND (NOT rsnews.EOF))
%>





<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
rsnews.MoveNext()
Wend
%>




">


<%=(rsnews.Fields.Item("word").value)%>


<%=(rsnews.Fields.Item("sm").value)%>





<%
rsnews.Close()
%>

编辑历史:[这消息被hmily编辑过(编辑时间2002-03-11 08:51:55)]