<% Option Explicit response.buffer = true %> Acronyms
CISR > Resource Library > Acronyms > Browse
Acronyms

Search | Browse
Index: <% if Session("LOGGEDIN") then %> <% end if %> <% dim sql sql = "Select * from Master ORDER BY Acronym" %> <% 'If the database is empty, tell the user so and quit. Else, create the display by first looping through 'the database and creating a quick index and then looping through again a second time to actually write 'out all the data. if rs.BOF And rs.EOF Then response.write "No Items Found" else 'Scan through and get the number of records dim numberOfRecords numberOfRecords = 0 do until rs.EOF rs.Movenext numberOfRecords = numberOfRecords + 1 loop ' Get the all the rows and put it in the array "results" dim results if rs.EOF then rs.MoveFirst results = rs.GetRows end if '-------------------------------Start of Bookmarks---------------------------------------- 'Scan through the results array and create an index dim index1, index2, switch, i index1 = "wonderful" 'Start scanning for i = 0 to (numberOfRecords - 2) switch = false index2 = index1 if left(results(0,i), 1) <> left(results(0,i+1), 1) then index1 = Ucase(left(results(0, i+1), 1)) if index1 = index2 then switch = false else switch = true end if end if 'Write out index if switch then response.Write("" & index1 & " ") end if next %>
'-------------------------------End of Bookmarks---------------------------------------- '-------------------------------Start Writing List---------------------------------------- %>
Total Records: <%=rs.recordcount%>

Acronym
Definition
<% rs.movefirst if rs.BOF And rs.EOF Then response.write "No Items Found" else Array = rs.GetRows intCol = 2 intRow = rs.RecordCount intRow = intRow-1 for y=0 to intRow 'This IF section is testing the first letter of the acronym in the current and next record 'to determine if the letter changes so it can create breaks in the table denoting such changes 'therefore creating a table that is easier to scan and search. if NOT y = intRow then length = len(Array(1,y)) length = length - (len(Array(1,y))-1) temp = Array(1,y) temp = left(temp,length) z = y+1 length = 0 length = len(Array(1,z)) length = length - (len(Array(1,z))-1) temp2 = Array(1,z) temp2 = left(temp2,length) elseif y-intRow = 0 then 'If there is only one record returned we want to print the heading row that includes the letter 'of the alphabet this record begins with. This will also prevent the application from thinking that 'we are at the end of the record set and therefore not print out the special character , which 'is used in the else statement below. length = len(Array(1,y)) length = length - (len(Array(1,y))-1) temp = Array(1,y) temp = left(temp,length) else 'If the end of the database is reached, we need to stop the application from creating a final 'break in the table, using "" as the highest value character in ASCII. I don't how to create this 'character, I don't even know what it is, so I just copied it from another website. :) temp = "" end if 'Writes out every record in the table one record at a time. %>
<%=array(1,y)%>
<%=array(2,y)%>
<% 'If the IF statement above finds a change in the first letter of the acronym, we create 'a new alphabetic section with a corrosponding bookmark. if temp < temp2 then response.Write("") %><%=temp2 %> - Top <% switch = false end if response.write "" next end if rs.Close rs = null conn.Close conn = null End if %>