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
%>
 
G

Guest

Try:
SELECT COUNT(*) AS tot ...

Jim Buyens
Microsoft MVP
http://www.interlacken.com
Author of:
*-----------------------------­-----------------------
|\----------------------------­-----------------------
|| Microsoft Windows SharePoint Services Inside Out
|| Microsoft Office FrontPage 2003 Inside Out
||----------------------------­-----------------------
|| Web Database Development Step by Step .NET Edition
|| Microsoft FrontPage Version 2002 Inside Out
|| Faster Smarter Beginning Programming
|| (All from Microsoft Press)
|/----------------------------­-----------------------
*-----------------------------­-----------------------
 

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