[thelist] Tip o'the day
Anthony Baratta
Anthony at Baratta.com
Fri Jan 5 14:45:11 CST 2001
<TIP AUTHOR="Anthony Baratta" SUBJECT="Coding">
Ever wonder what do to with code snippets that you have laying around a
script that have been displaced (but not deleted yet) or are waiting for
placement? As long as the snippets "compile", instead of commenting them
out - wrap them in a subroutine. This way you can cut and paste them faster
with out having to remove comment tags.
e.g. Here's a code snippet from ASP I use a lot and leave in the template
form for use later.
The commend storage way:
'' strQuery = "SELECT FROM WHERE = ''"
'' objDB_RecordSet.Open strQuery
'' if not (objDB_RecordSet.BOF AND objDB_RecordSet.EOF) then
'' objDB_RecordSet.MoveFirst
'' while not (objDB_RecordSet.EOF)
'' dict(Trim(objDB_RecordSet(""))) = Trim(objDB_RecordSet(""))
'' objDB_RecordSet.MoveNext
'' wend
'' end if
'' objDB_RecordSet.Clos
The sub routine way:
sub HoldingBin()
strQuery = "SELECT FROM WHERE = ''"
objDB_RecordSet.Open strQuery
if not (objDB_RecordSet.BOF AND objDB_RecordSet.EOF) then
objDB_RecordSet.MoveFirst
while not (objDB_RecordSet.EOF)
dict(Trim(objDB_RecordSet(""))) = Trim(objDB_RecordSet(""))
objDB_RecordSet.MoveNext
wend
end if
objDB_RecordSet.Clos
end sub '' HoldingBin()
</TIP>
---
Anthony Baratta
President
Keyboard Jockeys
More information about the thelist
mailing list