<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%> <% response.buffer = true %> Munitions Reference
Updated
CISR > Resource Library > Munitions Reference
Munitions Reference


To sort on Name, click on "Name" below. To sort on Type, click on "Type" below.

<% if request.QueryString("sort")<>"" then sort=request.QueryString("sort") else sort="name" end if const connectionStr = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=d:\inetpub\databases\MAIC_db_v1.mdb" dim conn Set conn = Server.CreateObject("ADODB.Connection") conn.Open connectionStr dim rs set rs=Server.CreateObject("ADODB.recordset") if sort = "type" then sql = "SELECT type, name, specs, description FROM Mine_info ORDER BY type" else sql = "SELECT name, type, specs, description FROM Mine_info ORDER BY name" end if rs.Open sql,conn 'If database is empty, output: NO ITEMS FOUND if rs.BOF And rs.EOF Then response.Write("NO ITEMS FOUND") END IF 'Scan through and get the number of records numberOfRecords = 0 do until rs.EOF rs.Movenext numberOfRecords = numberOfRecords + 1 loop ' Get the all the rows and put it in the array "results" if rs.EOF then rs.MoveFirst results = rs.GetRows end if %>
Index: <% 'Scan through the results array and create an index dim index1, index2, switch 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 %>
Total number of records: <%=numberOfRecords%>
<% 'Now response.write out the first record response.Write("") if sort = "type" then response.Write("" ) response.Write("" ) response.Write("" ) else for x=0 to 2 response.Write("" ) next end if response.Write("") 'Now response.Write out the rest of the records for y = 1 to (numberOfRecords -1) if left(results(0,y-1), 1) <> left(results(0,y), 1) then if sort = "type" then response.Write("") else response.Write("") end if response.Write("") 'If sorted by type, response.write out differently if sort = "type" then response.Write("" ) response.Write("" ) response.Write("" ) else for x=0 to 2 response.Write("" ) next end if response.Write("") else response.Write("") 'If sorted by type, response.write out differently if sort = "type" then response.Write("" ) response.Write("" ) response.Write("" ) else for x=0 to 2 response.Write("" ) next end if response.Write("") end if next %>
Name Type Specifications
" & results(1,y) & "" & results(0,y) & "" & results(2,y) & "" & results(x,0) & "
" & results(3,0) & "
" & UCase(left(results(0,y),1)) & " - Top
" & UCase(left(results(0,y),1)) & " - Top
" & results(1,y) & "" & results(0,y) & "" & results(2,y) & "" & results(x,y) & "
" & results(3,y) & "
" & results(1,y) & "" & results(0,y) & "" & results(2,y) & "" & results(x,y) & "
" & results(3,y) & "
<% rs.close conn.close %>