1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
|
<ASP Source><%</ASP Source><ASP Text> </ASP Text><Comment>'</Comment><Keyword>kate:</Keyword><Comment> </Comment><Variable>hl</Variable><String> ASP</String><Variable>;</Variable><br/>
<Control Structures>if</Control Structures><ASP Text> </ASP Text><Other>(</Other><ASP Text> </ASP Text><Function>instr</Function><Other>(</Other><Function>request</Function><ASP Text>.</ASP Text><Function>servervariables</Function><Other>(</Other><String>"PATH_INFO"</String><Other>),</Other><String>"login.asp"</String><Other>)</Other><ASP Text> <= </ASP Text><Decimal>0</Decimal><ASP Text> </ASP Text><Keyword>and</Keyword><ASP Text> </ASP Text><Function>instr</Function><Other>(</Other><Function>request</Function><ASP Text>.</ASP Text><Function>servervariables</Function><Other>(</Other><String>"PATH_INFO"</String><Other>),</Other><String>"inset"</String><Other>)</Other><ASP Text> <= </ASP Text><Decimal>0</Decimal><ASP Text> </ASP Text><Keyword>and</Keyword><ASP Text> </ASP Text><Function>instr</Function><Other>(</Other><Function>request</Function><ASP Text>.</ASP Text><Function>servervariables</Function><Other>(</Other><String>"PATH_INFO"</String><Other>),</Other><String>"Data"</String><Other>)</Other><ASP Text> <= </ASP Text><Decimal>0</Decimal><ASP Text> </ASP Text><Keyword>and</Keyword><ASP Text> </ASP Text><Function>instr</Function><Other>(</Other><Function>request</Function><ASP Text>.</ASP Text><Function>servervariables</Function><Other>(</Other><String>"PATH_INFO"</String><Other>),</Other><String>"dropDown"</String><Other>)</Other><ASP Text> <= </ASP Text><Decimal>0</Decimal><ASP Text> </ASP Text><Other>)</Other><ASP Text> </ASP Text><Control Structures>then</Control Structures><br/>
<ASP Text> </ASP Text><Function>Session</Function><Other>(</Other><String>"originalRequestedPage"</String><Other>)</Other><ASP Text> = </ASP Text><Function>Request</Function><ASP Text>.</ASP Text><Function>ServerVariables</Function><Other>(</Other><String>"PATH_INFO"</String><Other>)</Other><ASP Text> </ASP Text><Keyword>&</Keyword><ASP Text> </ASP Text><String>"?"</String><ASP Text> </ASP Text><Keyword>&</Keyword><ASP Text> </ASP Text><Function>Request</Function><ASP Text>.</ASP Text><Function>ServerVariables</Function><Other>(</Other><String>"QUERY_STRING"</String><Other>)</Other><br/>
<Control Structures>end if</Control Structures><br/>
<ASP Text></ASP Text><br/>
<Keyword>function</Keyword><ASP Text> countRecords</ASP Text><Other>(</Other><ASP Text> rsToCount </ASP Text><Other>)</Other><br/>
<ASP Text> numRecs = </ASP Text><Decimal>0</Decimal><br/>
<ASP Text></ASP Text><br/>
<ASP Text> </ASP Text><Control Structures>do</Control Structures><ASP Text> </ASP Text><Control Structures>until</Control Structures><ASP Text> rsToCount.</ASP Text><Keyword>eof</Keyword><br/>
<ASP Text> numRecs = numRecs + </ASP Text><Decimal>1</Decimal><br/>
<ASP Text></ASP Text><br/>
<ASP Text> rsToCount.</ASP Text><Keyword>movenext</Keyword><br/>
<ASP Text> </ASP Text><Control Structures>loop</Control Structures><br/>
<ASP Text></ASP Text><br/>
<ASP Text> rsToCount.</ASP Text><Keyword>close</Keyword><ASP Text> </ASP Text><Comment>' just to make sure nobody</Comment><br/>
<ASP Text> </ASP Text><Comment>' tries to operate on the recordset,</Comment><br/>
<ASP Text> </ASP Text><Comment>' which has already reached eof</Comment><br/>
<ASP Text></ASP Text><br/>
<ASP Text> countRecords = numRecs</ASP Text><br/>
<Keyword>end function</Keyword><br/>
<ASP Text></ASP Text><br/>
<Keyword>function</Keyword><ASP Text> unique</ASP Text><Other>(</Other><ASP Text> rs</ASP Text><Other>,</Other><ASP Text> sortColumn </ASP Text><Other>)</Other><ASP Text> </ASP Text><Comment>' return unique instances of text in sortColumn within rs</Comment><br/>
<ASP Text> </ASP Text><Keyword>dim</Keyword><ASP Text> sorted</ASP Text><Other>()</Other><br/>
<ASP Text></ASP Text><br/>
<ASP Text> </ASP Text><Keyword>redim</Keyword><ASP Text> sorted</ASP Text><Other>(</Other><Decimal>1</Decimal><Other>)</Other><br/>
<ASP Text> </ASP Text><Keyword>dim</Keyword><ASP Text> i</ASP Text><br/>
<ASP Text> i = </ASP Text><Decimal>0</Decimal><br/>
<ASP Text> </ASP Text><Control Structures>do</Control Structures><ASP Text> </ASP Text><Control Structures>until</Control Structures><ASP Text> rs.</ASP Text><Keyword>eof</Keyword><br/>
<ASP Text> </ASP Text><Control Structures>if</Control Structures><ASP Text> </ASP Text><Other>(</Other><Keyword>not</Keyword><ASP Text> find</ASP Text><Other>(</Other><ASP Text> rs</ASP Text><Other>(</Other><ASP Text>sortColumn</ASP Text><Other>),</Other><ASP Text> sorted </ASP Text><Other>))</Other><ASP Text> </ASP Text><Control Structures>then</Control Structures><br/>
<ASP Text> </ASP Text><Keyword>redim</Keyword><ASP Text> </ASP Text><Keyword>preserve</Keyword><ASP Text> sorted</ASP Text><Other>(</Other><ASP Text>i+</ASP Text><Decimal>1</Decimal><Other>)</Other><br/>
<ASP Text> sorted</ASP Text><Other>(</Other><ASP Text>i</ASP Text><Other>)</Other><ASP Text> = rs</ASP Text><Other>(</Other><ASP Text>sortColumn</ASP Text><Other>)</Other><br/>
<ASP Text> i = i + </ASP Text><Decimal>1</Decimal><br/>
<ASP Text> </ASP Text><Control Structures>end if</Control Structures><br/>
<ASP Text> rs.</ASP Text><Keyword>MoveNext</Keyword><br/>
<ASP Text> </ASP Text><Control Structures>loop</Control Structures><br/>
<ASP Text></ASP Text><br/>
<ASP Text> </ASP Text><Keyword>redim</Keyword><ASP Text> </ASP Text><Keyword>preserve</Keyword><ASP Text> sorted</ASP Text><Other>(</Other><ASP Text>i-</ASP Text><Decimal>1</Decimal><Other>)</Other><ASP Text> </ASP Text><Comment>' the function will add an extra blank entry to the array</Comment><br/>
<ASP Text></ASP Text><br/>
<ASP Text> rs.</ASP Text><Keyword>Close</Keyword><ASP Text> </ASP Text><Comment>' close the recordset - we'll be using it again - and reset i - well be using it again, too</Comment><br/>
<ASP Text></ASP Text><br/>
<ASP Text> unique = sorted</ASP Text><br/>
<Keyword>end function</Keyword><br/>
<ASP Text></ASP Text><br/>
<Keyword>sub</Keyword><ASP Text> testSub</ASP Text><Other>(</Other><ASP Text> variable </ASP Text><Other>)</Other><ASP Text> </ASP Text><Comment>' do nothing impressive...</Comment><br/>
<ASP Text> </ASP Text><Keyword>dim</Keyword><ASP Text> newVar</ASP Text><br/>
<ASP Text></ASP Text><br/>
<ASP Text> newVar = variable</ASP Text><br/>
<ASP Text></ASP Text><br/>
<ASP Text> </ASP Text><Control Structures>if</Control Structures><ASP Text> </ASP Text><Other>(</Other><ASP Text> variable = </ASP Text><Keyword>true</Keyword><ASP Text> </ASP Text><Other>)</Other><br/>
<ASP Text> </ASP Text><Function>response</Function><ASP Text>.</ASP Text><Function>end</Function><br/>
<ASP Text> </ASP Text><Control Structures>else</Control Structures><ASP Text> </ASP Text><ASP Source>%></ASP Source><br/>
<Normal Text></Normal Text><br/>
<HTML Tag><p></HTML Tag><Normal Text>We are writing text.</Normal Text><HTML Tag></p></HTML Tag><br/>
<HTML Tag><p</HTML Tag><Identifier> class=</Identifier><Types>"stuff"</Types><HTML Tag>></HTML Tag><ASP Source><%</ASP Source><ASP Text>=newVar</ASP Text><ASP Source>%></ASP Source><HTML Tag></p></HTML Tag><br/>
<HTML Tag><p></HTML Tag><Normal Text>We have written text and outputted a variable.</Normal Text><HTML Tag></p></HTML Tag><br/>
<Normal Text></Normal Text><br/>
<ASP Source><%</ASP Source><ASP Text> </ASP Text><Control Structures>end if</Control Structures><br/>
<Keyword>end sub</Keyword><ASP Text> </ASP Text><ASP Source>%></ASP Source><br/>
|