Help with this error. I will show you my code

R

Ron

Microsoft VBScript runtime error '800a0005'

Invalid procedure call or argument: 'left'





<%
set objFSO = CreateObject("Scripting.FileSystemObject")
'this is the folder you want to check change this to point to your folder
Set objFolder =
objFSO.GetFolder("c:\webffiliates\testimages\topekavow\housephotos")

Set colFiles = objFolder.Files

'This lined can be changed in cas other images are put in folder
name="topeka"

'Check Length of name variable
length=len(name)


'connect to the database
%>

<!--#include file="Connections/vowdsn.asp" -->
<%
set rs=server.createobject("adodb.recordset")


For Each objFile in colFiles

'These following lines just strip the filename down so it can compare with
field1 in the database

filename=objfile.name

lengthof=len(objfile.name)

filename=left(filename,length)

cutdownfile=mid(objfile.name,length+1,lengthof-length)

dbcount=len(cutdownfile)

finisheddbfile=left(cutdownfile,dbcount-4)

if name=filename then

response.write "Filename=" & objfile.name & "<br>"

rssql="SELECT * FROM [ListingsResidential-Residential] where field1='" &
finisheddbfile & "';"

rs.open rssql,myconn
'If file and record dont match then file is deleted
if rs.bof and rs.eof then

indata="No - File Deleted"

'filepath="C:\webffiliates\testimages\topekavow\housephotos\" & objfile.name
'objFSO.DeleteFile (filepath)

else
'File is not deleted
indata="Yes"
end if


rs.close

response.write "Exist in database=" & indata & "<br><br>"

else

end if

Next
%>
 
R

Ray at

On which line?

If:
filename=left(filename,length)
Is length defined and an integer > -1?

If:
finisheddbfile=left(cutdownfile,dbcount-4)
Is dbcount defined and an integer >= 4?

Ray at work
 
T

Tom B

length has been defined as the length of "Topeka" thus 6
are ALL filenames longer than 6 characters?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top