Database problem

I

Ian Hills

I'm trying to do a purge of uploaded files which are no longer referenced in
a
database table, and I can't see why the line

Set rset = conn.Execute(queryString)

generates a syntax error in IE. The script is below - can you help?

<%
uploadPath = Server.MapPath("../../../uploads")
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFldr = objFSO.GetFolder(uploadPath)
Set objFldrContents = objFldr.Files
For each objFileItem in objFldrContents
queryString = "SELECT COUNT AS tot FROM articles WHERE '" &
objFileItem.Name
& "' IN wpfield"
Set conn = Server.CreateObject(ADODB.Connection)
conn.Open "DSN=general"
Set rset = conn.Execute(queryString)
if rset("tot") = 0 then
objFileItem.Delete
endif
Set rset = Nothing
Set conn = Nothing
Next
%>
 

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

Top