Shrinking my code with Include files

Results 1 to 3 of 3

Thread: Shrinking my code with Include files

  1. #1
    Eric Neunaber Guest

    Default Shrinking my code with Include files

    About a year ago I was on a team that worked on a project that stored records in sql db and allowed you to Add, Update, Delete these records over the internet. I had just made the transition from vb to vbscript and wrote most of the code using top down logic. I now am trying to upgrade this project and I would like to use include files to store my connection object, set constants for customization, and to store functions that call the recordsets that I will use over and over again. I know how to use an include file to store functions, but how do I use it for these three items. Can someone show me an example…

  2. #2
    Join Date
    Dec 1969

    Default RE: Shrinking my code with Include files

    What you must remember is that using an include file is just like having the code automatically inserted before the ASP interpreter gets a whack at it.<BR><BR>So, just do:<BR><BR>ConnectionFile:<BR>Dim objConn<BR>Set objConn = Server.CreateObject("ADODB.Connection")<BR>objConn .Open "DSN=Blah"<BR><BR>Regular ASP file:<BR>&#060;!--#include file="ConnectionFile.asp"--&#062;<BR>&#060;%<BR> Dim objRS<BR> Set objRS = objConn.Execute("SELECT * FROM Table")<BR> objRS.Close<BR> Set objRS = Nothing<BR>objConn.Close<BR>Set objConn = Nothing<BR>%&#062;<BR><BR>So, you see, we just use objConn like it has been in there the entire time. Because, essentially, it is in there before the ASP interpreter starts processing.<BR><BR>Does this answer your question(s)?

  3. #3
    Eric Neunaber Guest

    Default RE: Shrinking my code with Include files

    Scott:<BR><BR>If you were a woman...I&#039d kiss you instead I&#039ll buy you a beer if you ever down on the landing. <BR><BR>I think I can figure out everything else I need to know....<BR><BR>Thanks again,<BR>eric

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts