instead of enumerating over fields, do an iteration. data = rs.getRows() for x = 1 to ubound(data,2) for y = 0 to 2 response.write data(y,x) next next or something like that (this is untested) but it grabs and converts your recordset to a 2dim array and iterates over it it - you'll see it starts with 1 instead of 0...
ubound(Array) gets the upper bounds - the count, of an array. ubound(array,2) gets the upper bounds of the first dimension of a 2 dimensional array.
ran into another problem. If the cell ( is that what it's called ) contains no data, the split function which I inserted causes to give an error. dim txt,a if x.value IsNull then response.write("") else txt= x.value a=Split(txt, "&") response.write(a(0) & "<br />") 'response.write(a(1)) end if Code (markup):
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: <% 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 [B][COLOR="Red"] 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[/COLOR][/B] ' response.flush 'Flush Response buffer to screen ' Erase arrayR Set rs = nothing Set conn = nothing %> Code (markup):