采用vb的InStr函数 如果存在的话返回值>0,过可以得出结论
代码如下deal.asp
<%@ language="vbscript"%>
<%response.Expires = 0%>
<!--#include file="conn.asp"-->
<%
Dim objFSO,objFolder,objFile,FF '声明 objFSO 变量存放对象实例
FF = Server.MapPath("pro_s/")
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
If objFSO.FolderExists(ff) Then
Response.write "文件夹 "&ff&" 里所有的文件:<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 while 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 "文件夹"&ff&"不存在,无法读取相关信息!"
End If
Set objFolder = Nothing
Set objFSO = Nothing '释放 FileSystemObject 对象实例内存空间
%>
来自:http://blog.csdn.net/lingfeng179/archive/2009/08/19/4463679.aspx