[thelist] Included files

Scott Dexter sgd at ti3.com
Thu Mar 1 10:55:03 CST 2001


> 
> I had a question about included files as well. Almost
> all my ASP files have SQL statements and some of them
> use the same SQL statements. Would it be a good idea
> to put all the SQL statements into a single file and
> then include this file in all the ASP files? Would
> this cause a lot of overhead?

put common ones into functions and have a separate functions.asp page that
you include. A good trick is to have your ASP include file have *zero* HTML
in them --that way the ASP engine can cache the parsed code.

The MS way is to have the SQL statements in Application variables and
replace tokens with actual values when you use it. Example:

(MSCSQueryMap is an Application scope dictionary, AddQuery() is just a
wrapper function to include recordset settings with the statement)

        Set MSCSQueryMap.dept_by_id = AddQuery("SELECT dept_id, dept_name,
dept_description FROM mall_dept WHERE dept_id = :1")

I'm not so sure I subscribe to that method, but it does keep things in one
place (the global.asa). I guess I don't like messing with the global.asa
more than I have to, because everytime you save it, the site has to restart,
and I don't like doing that to my users....

sgd




More information about the thelist mailing list