%@ LANGUAGE = VBScript %>
<% Option Explicit %>
<%
'JAMES GJERDE
'RIVERKING TECHNOLOGIES GLOSSARY PAGE 2003
On Error Resume Next
Dim alphaList(26)
Dim i
Dim objConn
Dim objRec
Dim bResults
Dim SQL
Dim strLetter
Dim strTerm
Dim strDefinition
Dim re 'regular expression object
Dim bValidLetter
alphaList(0)="A"
alphaList(1)="B"
alphaList(2)="C"
alphaList(3)="D"
alphaList(4)="E"
alphaList(5)="F"
alphaList(6)="G"
alphaList(7)="H"
alphaList(8)="I"
alphaList(9)="J"
alphaList(10)="K"
alphaList(11)="L"
alphaList(12)="M"
alphaList(13)="N"
alphaList(14)="O"
alphaList(15)="P"
alphaList(16)="Q"
alphaList(17)="R"
alphaList(18)="S"
alphaList(19)="T"
alphaList(20)="U"
alphaList(21)="V"
alphaList(22)="W"
alphaList(23)="X"
alphaList(24)="Y"
alphaList(25)="Z"
bResults=0 'boolean that says we have results for this letter
strTerm=""
strDefinition=""
bValidLetter=0
Set re = new RegExp
re.Pattern = "\b[A-Z]\b"
re.IgnoreCase = False
re.Global = True
strLetter=UCase(Request.QueryString("letter")) 'set the letter to uppercase to match the reg expression
'now if we have a valid letter parameter
'do the db connection
Set objConn = Server.CreateObject ("ADODB.Connection")
Set objRec = Server.CreateObject ("ADODB.Recordset")
If re.Test(strLetter) Then
objConn.Open "DSN=riverweb"
bValidLetter=1
SQL = "SELECT term, definition FROM TERMS WHERE term Alike '" & strLetter & "%' AND CATEGORY = 'Technology Terms' ORDER BY term"
If Err.Number=0 Then
objRec.Open SQL,objConn, 2, 1, 1
If Not objRec.EOF or Not objRec.BOF Then
bResults=1 'we have some records
End If
End If
Else
strLetter="you have entered because actually you have entered invalid data. You are a complete fool"
'this statement above sets the letter string to an error message, this message is appended
'to another message later in the html page
End If
%>
Riverking Technologies
<%If Err.Number<>0 Then %>
An error has occurred. The connection attempt failed.
Please contact the webmaster if you have any questions.
Click here to return to the homepage.
<%Else%>
<% If bValidLetter=1 Then
For i = 0 To 25
If alphaList(i) = strLetter Then %>
<%If bValidLetter=1 Then
While Not objRec.EOF
strTerm = objRec("term")
strDefinition = objRec("definition") %>
<%= strTerm %>
<%= strDefinition %>
<% objRec.MoveNext
WEnd
End If
If bResults=0 Then %>
There are currently no terms available that start with the letter <%= strLetter %>.
<%End If %>
Copyright Riverking, Inc. 2002. All Rights Reserved.
<%
If bValidLetter Then 'if we had a valid letter, we opened the recordset
objRec.Close
objConn.Close
End If
Set objRec = Nothing
Set objConn = Nothing
End If
%>