|
|
8000XXXX Errors Alerts ASP.NET 2.0 Classic ASP 1.0 COM / ActiveX Components Forms General Topics Date/Time Routines Email Scripts & Info Files/Directories & FSO Databases General Concepts Search Engine Optimization (SEO)Search | ASP FAQ Tutorials :: Classic ASP 1.0 :: Files/Directories & FSO :: Why do I get 'Invalid procedure call or argument'? Why do I get 'Invalid procedure call or argument'?This often happens because you used a VBScript "friendly name" constant in place of its integer equivalent. Visual Basic understands these friendly names, such as FileSystemObject's 'forAppending' and 'forWriting' constants. An easy solution is to add this line to any include files you use in every page (or else add it at the top of every page, if you don't have a common header in your application):
Another possible cause is trying to use a string operation (like Mid(), InStr(), Left() or Right()) on a NULL value. So for example:
Should be:
If you're having these problems with NULL values coming out of a database, see Article #2150. Another possibility is that you are coming over from JavaScript, or otherwise think that string lengths are 0-based. The following code sample will cause this error:
Similarly, passing a starting argument of 0 to the Instr() function will cause the same error. To solve this problem, always start at 1 for string parsing in VBScript. Still one more possibility is that you have unexpected characters in an FSO writeline call. I recently came across this when using MSXML to write out contents of dynamic ASP files into static HTML files. I had this:
When I ran this code, I received the above error. When I added the unicode format designator, as follows, everything worked fine:
Related Articles Can I include a file in both server-side and client-side script? Can I read / write a user's file without a prompt? Can I rename a file using FileSystemObject? Could I get some help working with files using FileSystemObject? How do I avoid 'the red x' when an image is missing? How do I change the modified time of a file? How do I create / manipulate images from ASP? How do I dynamically include files? How do I find the owner, author, and other properties of a file? How do I get a list of a folder's subfolders? How do I get the name of the current URL / page? How do I prevent people from 'leeching' my CSS or JS files? How do I prevent people from 'leeching' my images? How do I retrieve a random file from a given folder? How do I send the correct filename with BinaryWrite? How do I sort a list of files? How do I use FileSystemObject to create a file on the client? Why do I get 'Disk not ready' errors with FileSystemObject? Why do I get 'Path not found' errors with Scripting.FileSystemObject? Why do I get 'Permission Denied' errors with FileSystemObject? Why do I get 800A0034 errors? Why do I get 800A003E / Input past end of file errors? Why do I get 800A0BBA errors? Why do I get 800A0BBC errors? Why do I get an 'Invalid Path Character' error? Why do I get permissions errors after upgrading to Windows XP? Why does FileSystemObject hang all of a sudden? Why is 'the operation completed successfully' an error message? |