Hello everyone and anyone. I'm a novice at ASP but am learning a great deal from this forum. I have a piece of looping code that I'm trying to manipulate to look at an if-then, but I'm not sure that it's possible.
I'll do my best to explain this. The code creates a drop-box. It's contents of the drop-box is derived by the looping code. This code takes data from two fields in a MSSQL DB table (personnel). A specific amount of time is added to the value of one field and continues to add this amount of time until it reaches the value in the other field. Thus displaying all of the results in the drop box. When a user makes a choice and clicks submit, this choice is saved in another MSSQL DB table (schedule). When the user wants to edit the schedule table, the choice that the user originally chose is NOT selected in the drop-box.
Here is the originally code for the loop (this works fine):
<SELECT NAME="bhsunopen">
<%
Dim strSunapptframe
strSunapptframe = "30"
addTime = dateadd("H","0",strSunOpen)
Do While addTime <= dateadd("H","0",strSunClose)
addTime = DateAdd("n",strSunapptframe,addTime)
Response.Write "<OPTION VALUE=" & addTime & ">" & addTime & "</OPTION>"
Loop
%></select>
Although I know this is wrong, I'm going to put it here anyway so you can see what I really need:
<SELECT NAME="bhsunopen">
<%
Dim strSunapptframe
strSunapptframe = "30"
addTime = dateadd("H","0",strSunOpen)
Do While addTime <= dateadd("H","0",strSunClose)
addTime = DateAdd("n",strSunapptframe,addTime)
Response.Write "<OPTION VALUE=" & addTime & [RIGHT HERE: if objRS("bhsunopen")=addTime Then Response.Write "Selected"]">" & addTime & "</OPTION>"
Loop
%></select>
Is this possible? Any and all help is and will be greatly appreciated.
I'll do my best to explain this. The code creates a drop-box. It's contents of the drop-box is derived by the looping code. This code takes data from two fields in a MSSQL DB table (personnel). A specific amount of time is added to the value of one field and continues to add this amount of time until it reaches the value in the other field. Thus displaying all of the results in the drop box. When a user makes a choice and clicks submit, this choice is saved in another MSSQL DB table (schedule). When the user wants to edit the schedule table, the choice that the user originally chose is NOT selected in the drop-box.
Here is the originally code for the loop (this works fine):
<SELECT NAME="bhsunopen">
<%
Dim strSunapptframe
strSunapptframe = "30"
addTime = dateadd("H","0",strSunOpen)
Do While addTime <= dateadd("H","0",strSunClose)
addTime = DateAdd("n",strSunapptframe,addTime)
Response.Write "<OPTION VALUE=" & addTime & ">" & addTime & "</OPTION>"
Loop
%></select>
Although I know this is wrong, I'm going to put it here anyway so you can see what I really need:
<SELECT NAME="bhsunopen">
<%
Dim strSunapptframe
strSunapptframe = "30"
addTime = dateadd("H","0",strSunOpen)
Do While addTime <= dateadd("H","0",strSunClose)
addTime = DateAdd("n",strSunapptframe,addTime)
Response.Write "<OPTION VALUE=" & addTime & [RIGHT HERE: if objRS("bhsunopen")=addTime Then Response.Write "Selected"]">" & addTime & "</OPTION>"
Loop
%></select>
Is this possible? Any and all help is and will be greatly appreciated.