Question

We have a simple file browser on our intranet, built using ASP/vbscript. The files are read by the script and added to an ADO Recordset (not connected to a database), so we can sort the contents easily:

        Set oFolderContents = oFolder.Files
        Set rsf = Server.CreateObject("ADODB.Recordset")
        rsf.Fields.Append "name", adVarChar, 255
        rsf.Fields.Append "size", adInteger
        rsf.Fields.Append "date", adDate
        rsf.Fields.Append "type", adVarChar, 255
        rsf.Open

        For Each oFile In oFolderContents
            if not left(oFile.Name, 3) = "Dfs" then 'Filter DFS folders
                rsf.AddNew
                rsf.Fields("name").Value = oFile.Name
                rsf.Fields("size").Value = oFile.Size
                rsf.Fields("date").Value = oFile.DateCreated
                rsf.Fields("type").Value = oFile.Type
            end if
        Next

In one particular folder we are getting an error:

Microsoft Cursor Engine error '80040e21'
Multiple-step operation generated errors. Check each status value.

This points to the line

rsf.Fields("name").Value = oFile.Name

in the code above.

My initial thought this was caused by a long file name, but I checked the length of all the files in the directory - although some are quite long, all are under the 255 character limit set above (largest is 198 characters long).

The folder in question has nearly 2000 PDFs in it, and I do not have permissions to alter the contents, just read (it's a technical library). The files have a naming convention of "ID# - Paper Title". Some have special characters such as ', &, and ( or ) - could some of these be causing the issue? I don't recall having such a problem before. I tried searching Google for special characters in ADO, but couldn't find anything which seemed relevant.

Thanks :-)

Was it helpful?

Solution

Have you tried using adVarWChar for the name column?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top