I have: <select id="sel1" name="sel1" onchange="" size="20"> <%do until rs.EOF%> <% i = 0 for each x in rs.Fields if i = 0 then i = 1 else %> <option href="showverse.asp?<%Response.Write(x.value)%>"> <% 'OPTION EXPLICIT dim txt,a If IsNull(x.value) then response.write("") else txt= x.value a=Split(txt, "&") 'opening the bible table 'Opening Database connection Set Conn2 = Server.CreateObject("ADODB.Connection") Conn2.Open DSNName 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(a(0) & " ") 'response.write(a(1)) end if %> </option> <% ' process the rest of the loop except the one ignored above end if next rs.MoveNext%> <%loop rs.close conn.close%> </select> Code (markup): At first I had a table where rs.Fields was suitable but I want to change to select dropdowns. I'm trying to think how I'm going to be able to make the script populate the 22 dropdowns (according to the 22 fields) instead of populating record-by-record.
do a GetRows() Dim RowData RowData = rs.GetRows() rs.close conn.close conn = nothing now you have RowData which is a 2 dimensional array of your records
Ok here's what I had laid out in table format: http://i.domaindlx.com/wheelofgod/search/cat/list.asp ( If that doesn't work I have one set in the root: http://i.domaindlx.com/wheelofgod/list.asp ) But here's what I have so far in Select field: http://i.domaindlx.com/wheelofgod/search/cat/biblewheeldata1.asp The script I posted previously is where I'm stuck. I think I have to use the Dim RowData RowData = rs.GetRows() Code (markup): But How? Does it replace "for each x in rs.Fields" or what?
hmmm i don't think that's what I'm looking for. I have: <% DSNName = "DRIVER=Microsoft Access Driver (*.mdb);DBQ=" DSNName = DSNName & Server.MapPath("../../kjv.mdb") DSNName = DSNName & ";PWD=" & "mypass" 'Opening Database connection Set Conn = Server.CreateObject("ADODB.Connection") Conn.Open DSNName set RS = Server.CreateObject("ADODB.recordset") 'This SQL statement creates a list of spokes SQL1 = "Select * from inssp" [B][COLOR="Red"] 'url extensions table[/COLOR][/B] rs.Open sql1,conn, 1 %> <% i = 0 for each x in rs.Fields if i = 0 then i = 1 else response.write("<span id='" & x.name &"'>" & x.name & "</span>") ' process the rest of the loop except the one ignored above end if next%> <div id="divform"> <form name="frm" id="frm"> <select id="sel1" name="sel1" onchange="" size="20"> <%do until rs.EOF%> <% i = 0 for each x in rs.Fields if i = 0 then i = 1 else %> <option href="showverse.asp?<%Response.Write(x.value)%>"> <% 'OPTION EXPLICIT dim txt,a If IsNull(x.value) then response.write("") else txt= x.value a=Split(txt, "&") '[B][COLOR="Red"]opening the bible table used to simply fetch the name of the book[/COLOR][/B] 'Opening Database connection Set Conn2 = Server.CreateObject("ADODB.Connection") Conn2.Open DSNName 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) '[B][COLOR="Red"]for your info after splitting the url extension a(0) is "book=number" and a(1) is "chapter=number". [/COLOR][/B] rs2.Open sql2,conn2, 1 response.Write(rs2("book_title") & " " & rs2("chapter") ) ' [B][COLOR="Red"]book_title is the name of the book like genesis, exodus and chapter is the chapter[/COLOR][/B] 'response.Write(sql2) rs2.close conn2.close 'response.write(a(0) & " ") 'response.write(a(1)) end if %> </option> <% ' process the rest of the loop except the one ignored above end if next rs.MoveNext%> <%loop rs.close conn.close conn = nothing %> Code (markup): except that the rs.Fields is not helpful in this (otherwise everything else runs smoothly). I need a populating by columns.
Ok let's use a simple example from w3schools.com and work on that: <% 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 'The first number indicates how many records to copy 'The second number indicates what recordnumber to start on p=rs.GetRows(8,0) rs.close conn.close 'This example returns the value of the first 'column in the first two records response.write(p(1,0)) response.write("<br />") response.write(p(1,1)) response.write("<br />") response.write(p(1,2)) response.write("<br />") response.write(p(1,3)) response.write("<br />") response.write(p(1,4)) response.write("<br />") response.write(p(1,5)) response.write("<br />") response.write(p(1,6)) response.write("<br />") response.write(p(1,7)) response.write("<br />") %> Code (markup): How do you make this ubound? With a for loop?
so, now p has the 2-dim array. so you could do: for x = ubound(p,2) response.write p(0,x) response.write p(1,x) response.write p(2,x) next I believe its p(2,x) - if not try p(x,2) one or the other, hehe.