📄 delattach.asp
字号:
<%option explicit%>
<!--#include virtual="include/DataEnvi.asp"-->
<%
Dim objDB,strSQL,objRS,ObjFS
Dim StrDelIDs,StrIDs
Dim StrFileName,StrFilePath
Dim ObjCrm,StrSqlCrm,StrReplace,KeyPath
Set objDB = server.CreateObject("ADODB.Connection")
Set ObjFS = Server.CreateObject("Scripting.FileSystemObject")
OpenDBH objDB
StrIDs = Request.QueryString("IDs")
StrDelIDs = Request.QueryString("DelIDs")
StrIDs = "," & StrIDs & ","
StrIDs = Replace(StrIDs,"," & StrDelIDs & ",",",")
If Len(StrIDs)>3 Then StrIDs = Mid(StrIDs,2,Len(StrIDs)-2)
strSQL = "Select * From t_Hrms_Attach Where KeyPath In ('" & Replace(StrDelIDs,",","','") & "')"
'response.write strsql
'response.End()
Set ObjRS = objDB.Execute(Strsql)
While Not ObjRS.Eof
'-------------------------------------------------------------------------------------------
KeyPath=ObjRS("KeyPath")
'--------------------------------------------------------------------------------------------
StrFilePath = Server.MapPath ( Application("RootPath") & "Hrms/Attach/Files/" & ObjRS("BasePath") & "/" & ObjRS("KeyPath") )
'response.write StrFilePath &"<br>"&ObjFS.FolderExists(StrFilePath)
'response.End()
If ObjFS.FolderExists(StrFilePath) Then
ObjFS.DeleteFolder StrFilePath,true
objDB.Execute("DELETE FROM t_Hrms_Attach Where KeyPath In ('" & Replace(StrDelIDs,",","','") & "')")
'-------------------------------------------------------------------------------------------
'在操作完OA中的t_Hrms_Attach表中的记录后马上修改Kingcrm库中t_crm_Bargain表中相应的记录
if (Session("Table_id")<>"") Then
Set ObjDB = Server.CreateObject("Adodb.Connection")
OpenDBH ObjDB
StrSqlCrm= "Select * From "&Session("TableName")&" Where ID= "&Cint(Session("Table_id"))
Set ObjCrm=Server.CreateObject("Adodb.RecordSet")
ObjCrm.Open StrSqlCrm,ObjDB,1,3
StrReplace=ObjCrm("Attachs")
StrReplace=Replace(StrReplace,","&KeyPath,"")
ObjCrm("Attachs")=StrReplace
ObjCrm.Update
ObjCrm.Close
Set ObjCrm=Nothing
ObjDB.Close
Set ObjDB=Nothing
End if
'-------------------------------------------------------------------------------------------------
End If
ObjRS.MoveNext
Wend
Response.Redirect "AddNew.asp?IDs=" & StrIDs & "&BasePath=" & Request.QueryString("BasePath")
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -