For some reason the code is making an extra select field than the number of fields available in the database table and it's giving an error:
Quote:
quote:<span class='spokes' id='spoke23'>Spoke 23<br />
<select class='selspokes' id='sp23'>
<p>Microsoft VBScript runtime error '800a0009'
<p>
Subscript out of range: '23'
<p>
/wheelofgod/search/cat/biblewheeldata1.asp, line 119
|
Code:
<%
set conn=Server.CreateObject("ADODB.Connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.Open(Server.Mappath("../../kjv.mdb"))
set rs = Server.CreateObject("ADODB.recordset")
rs.Open "Select * from inssp", conn
arrayR = rs.GetRows() 'This has been altered to use an ARRAY. Because we are not putting limits on it (i.e. (8,0), we have made it dynamic AND 2-dimensional
maxC = rs.Fields.Count 'This line creates variable maxC, sets it to max fields in database
maxR = UBOUND(arrayR,2) 'This line creates variable called maxP, defines it as the upper limit of our array.
rs.close
conn.close
For y=1 to maxR 'Loop through the ARRAY ROWS starting at 0 to the upper limit of our array
Response.write("<span class='spokes' id='spoke" & y & "'>Spoke " & y & "<br />")
Response.write("<select class='selspokes' id='sp" & y & "'>")
For x=0 to maxC 'Loop through the ARRAY COLUMNS starting at 0 to MAX COLUMNs minus 1 (since we are starting at 0)
'OPTION EXPLICIT
dim txt,a
If IsNull(arrayR(y,x)) then
response.write("")
else
response.write("<option href='showverse.asp?" & arrayR(y,x) & "'>")
txt= arrayR(y,x) 'x.value
a=Split(txt, "&")
'response.write(a(0) & " ")
'response.write(a(1))
'opening the bible table
'Opening Database connection
set conn2=Server.CreateObject("ADODB.Connection")
conn2.Provider="Microsoft.Jet.OLEDB.4.0"
conn2.Open(Server.Mappath("../../kjv.mdb"))
set rs2 = Server.CreateObject("ADODB.recordset")
'This SQL statement creates a list of books
SQL2 = "Select * from bible"
sql2 = sql2 & " where " & a(0) & " AND " & a(1)
rs2.Open sql2,conn2, 1
response.Write(rs2("book_title") & " " & rs2("chapter") )
'response.Write(sql2)
rs2.close
conn2.close
response.Write("</option>") 'Here, instead of p(1,0), we want to use the ARRAY. Also, we are combining the 2 response.write lines together
end if
Next
Response.write("</select></span><br />")
Next
'
response.flush 'Flush Response buffer to screen
'
Erase arrayR
Set rs = nothing
Set conn = nothing
%>