This is a discussion on retreive DB values into a DD box within the ASP Development forums, part of the Programming & Scripting category; Code: <fieldset style="padding: 2; width:600px; height:53"> <legend><font color="#0000FF"><b>Talent Review</b></font></legend> <font face="Arial"> <font size="2"> 4</font><font size="2" face="Arial">) High Potential:</font> <select name="High_Potential" ...
| |||||||
|
#1
| ||||
| ||||
| Code: <fieldset style="padding: 2; width:600px; height:53">
<legend><font color="#0000FF"><b>Talent Review</b></font></legend>
<font face="Arial">
<font size="2"> 4</font><font size="2" face="Arial">) High
Potential:</font>
<select name="High_Potential" size="1" style="width: 111; height: 21" >
<option selected>Choose One...</option>
<option value="Yes0" >Yes</option>
<option value="No0" >No</option>
</select ><font color="#FF0000"><%=response.write(rs("High_Potential"))%></font>
</font>
</fieldset></p>
|
|
#2
| ||||
| ||||
| Hi wbva, you need a select query....also, it appears your response.write is on the outside of the </select> tag. ? How about something like this... Code: <select name="High_Potential" size="1" style="width: 111; height: 21" >
<%
Set Rs=Server.CreateObject("adodb.recordset")
strSQL = "SELECT DISTINCT HighPotential FROM yourTableName"
strSQL = strSQL & " ORDER BY HighPotential"
Rs.Open strSQL, conn
Do while not Rs.EOF
if Request.Form("High_Potential") = Rs("High_Potential") then
Response.Write "<OPTION VALUE = '" & Rs("High_Potential") & "' SELECTED>"
Response.Write Rs("High_Potential") & "</Option>"
Rs.MoveNext
else
Response.Write "<OPTION VALUE = '" & Rs("High_Potential") & "'>"
Response.Write Rs("High_Potential") & "</Option>"
Rs.MoveNext
end if
loop
%>
</SELECT>
|
|
#3
| ||||
| ||||
| Quote:
Code: <%
'Checking to see what request is being submitted
IF Request.Form("submit")="submit" Then
username=request.form("username") ' Get the unique Ref being searched for
'create a record set
Set rs=Server.CreateObject("ADODB.RecordSet")
'Query the database
sql= "SELECT * FROM [Exec-3] WHERE username = '" & username& "'"
rs.open sql, conn, 1, 1
IF NOT rs.eof THEN
response.write sql
%>
|
|
#4
| ||||
| ||||
| Hi wbva, Not sure what you mean "other selectable values"...? .. other value other than from database? Also, if you already had query at the top of page then you don't have to repeat...just start with the do while line. |
|
#5
| ||||
| ||||
| Quote:
say the drop down retreives 'Yes' but the user wants to change this to 'No'.. they cant seem to do that as all the code does is retreieve. |
|
#6
| ||||
| ||||
| ok, thought that but wanted to clarify .. .how about line in blue...i may have quotes wrong but give it a try. Do while not Rs.EOF if Request.Form("High_Potential") = Rs("High_Potential") then Response.Write "<OPTION VALUE = 'No' SELECTED>"No</Option>" Response.Write "<OPTION VALUE = '" & Rs("High_Potential") & "' SELECTED>" Response.Write Rs("High_Potential") & "</Option>" Rs.MoveNext else Response.Write "<OPTION VALUE = 'No' SELECTED>"No</Option>" Response.Write "<OPTION VALUE = '" & Rs("High_Potential") & "'>" Response.Write Rs("High_Potential") & "</Option>" Rs.MoveNext end if loop |
|
#7
| ||||
| ||||
| Rebelle, you can achieve the same thing with much less code, using this logic: Code: Do While Not rs.EOF
strHP = rs("High_Potential")
response.write "<option value=""" & strHP & """"
If CStr(Request.Form("High_Potential")) = CStr(strHP) Then
response.write " selected"
End If
response.write ">" & strHP & "</option>" & vbCrLf
rs.MoveNext
Loop
WBVA, I have no clue what you are trying to say. Can you please rephrase your question?
__________________ "You'll never be as perfect as BLaaaaaaaaarche." |
| The Following User Says Thank You to BLaaaaaaaaaarche For This Useful Post: | ||
Rebelle (March 30th, 2009) | ||
|
#8
| ||||
| ||||
| Quote:
have a drop down box with the values Yes, No and N/A. If the user (from another page) has inserted Yes, then my update page should retreive Yes into the drop down box. As this is an update page it should have a choice of the other values in case the user wants to change the value to No. |
|
#9
| ||||
| ||||
| got this error : Error Type: ADODB.Field (0x80020009) Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record. admin/Form3_Update.asp, line 93 |
|
#10
| ||||
| ||||
| Put BLarche's code between this: Code: If Not rs.BOF And Not rs.EOF Then
' BLarche's code here
End If
__________________ jmurrayhead If you agree with me... click the icon! If my post solved your problem, click the button in the lower right-hand corner of the post.If you like it here...throw us a few bones to help support us. Join our Folding team: DeveloperBarn Folding |
![]() |
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
| |
| ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| best way to bind values to sql statement? | Centurion | ASP Development | 11 | March 17th, 2009 06:45 AM |
| getting values from tables | todd2006 | ASP Development | 7 | February 2nd, 2009 06:33 PM |
| Converting Null Values to Zero | nboscaino | Microsoft Access | 3 | September 4th, 2008 01:02 PM |
| finding values | todd2006 | ASP Development | 2 | June 23rd, 2008 02:03 AM |
| retrieve values | todd2006 | SQL Development | 5 | June 19th, 2008 01:46 PM |