Classic ASP DatabasesDiscuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Classic ASP Databases section of the Wrox p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.
I have a problem selecting a value from a recordset. The code i have currently populates the select box but i would like to select a value depending on my other recordset.
Its actually an update procedure im doing, but i want to return a recordset in an editable format with select boxes.
<%
Set oRs=Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT DISTINCT manager FROM tblManager ORDER BY manager"
oRs.Open strSQL
Do while not oRs.EOF
if Request.Form("selmanager") = oRs("manager") then 'if this is the selected one then display as selected
Response.Write "<OPTION VALUE = '" & oRS ("manager") & "' SELECTED>"
Response.Write oRs("manager") & "</Option>"
oRs.MoveNext
else
Response.Write "<OPTION VALUE = '" & oRs ("manager") & "'>"
Response.Write oRs("manager") & "</Option>"
oRs.MoveNext
end if
loop
%>
this code fills my select box fine, but im strugling when i want to select a default value.
... because you take that ( oRs.MoveNext ) behind the condition ?
<%
Set oRs=Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT DISTINCT manager FROM tblManager ORDER BY manager"
oRs.Open strSQL
Do while not oRs.EOF
if Request.Form("selmanager") = oRs("manager") then 'if this is the selected one then display as selected
Response.Write "<OPTION VALUE = '" & oRS ("manager") & "' SELECTED>"
Response.Write oRs("manager") & "</Option>"
else
Response.Write "<OPTION VALUE = '" & oRs ("manager") & "'>"
Response.Write oRs("manager") & "</Option>"
end if