ASP Delete No records in the MSSQL database picture code _ Application Tips

Source: Internet
Author: User
Use double loops. Take the picture "." After the split name asked the previous section, that the rest of the database in the picture path record to compare
Using the InStr function of VB, if there is a return value of >0, can come to a conclusion
The code is as follows deal.asp
Copy Code code as follows:

<%@ language= "VBScript"%>
<%response. Expires = 0%>
<!--#include file= "conn.asp"-->
<%
Dim objfso,objfolder,objfile,ff ' declares objFSO variable holds object instance
FF = Server.MapPath ("pro_s/")
Set objFSO = Server.CreateObject ("Scripting.FileSystemObject")
If objfso.folderexists (FF) Then
Response.Write "Folder" &ff& "All the Files:<br>"
Set objfolder = Objfso.getfolder (FF)

For each objfile in Objfolder.files
%>
<%
Filename=cstr (Objfile.name)
Myname=split (FileName, ".")
Ffname=myname (0)
A=0
Set Sclass=conn.execute ("Select img from Wksc_pro")
Do as not sclass.eof

Result=instr (Sclass ("img"), Ffname)
A=a+result
if (a>0) then
Exit Do
End If

Sclass.movenext
Loop
if (a=0) then
Response. Write "" &objFile& ""
Response. Write "<br>"
Objfile.delete

End If
%>
<%
Next
Else
Response.Write "Folder" &ff& does not exist and cannot read the relevant information! "
End If
Set objfolder = Nothing
Set objFSO = Nothing ' Frees FileSystemObject object instance memory space
%>

From: http://blog.csdn.net/lingfeng179/archive/2009/08/19/4463679.aspx

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.