-
syntax error from function in include file
Hi, good programmer but complete noob to ASP/VBscript here, with what must be a painfully obvious noob question...
If I define a function (using sample code from here on devx.com):
<%
function WriteToFile(FileName, Contents, Append)
...
end function
%>
inline in any of several .asp files, it works fine. But if I define the exact same function inside a separate .asp include file and include the file in those original .asp files, I get a syntax error:
Microsoft VBScript compilation error '800a03ea'
Syntax error
/fsglobals.asp, line 7
function WriteToFile(FileName, Contents, Append)
^
Why? Searching the web I find plenty of sites talking about the benefits of defining ASP functions inside include files, but no amount of searching on this forum or on the web has turned up a useful example or a hint as to why this isn't working as expected.
Thanks hugely for any help.
-
Of course, as soon as I post, I figure it out. I found a question on another site about a similar problem, and though the ultimate cause was different, the main clue there was that the problem wasn't due to the include file or the function, but something before it or, more precisely, where exactly the include took place. I was dealing with someone else's code that had a for loop start in an include file and complete inline (grumble, grumble), so I didn't realize I was trying to do my include inside a loop. (I didn't realize that would be a no-no either, given that the include wasn't within <% %> VBscript delimiters, but it does make sense.) Simply getting the include out of the loop did the trick.
Similar Threads
-
Replies: 2
Last Post: 12-29-2008, 11:40 AM
-
By jsgasking in forum C++
Replies: 4
Last Post: 08-28-2008, 05:42 PM
-
By Mick George in forum VB Classic
Replies: 2
Last Post: 01-02-2003, 02:32 PM
-
Replies: 1
Last Post: 11-27-2001, 06:53 AM
-
By Michael Shutt in forum VB Classic
Replies: 6
Last Post: 04-05-2001, 02:25 AM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks