select取值的选择难题
如何将
<option value=博士学位> 博士学位 </option>
<option value=硕士学位> 硕士学位 </option>
<option value=学士学位> 学士学位 </option>
格式化成
<option value=博士学位 <%if rs( "ds_xl ")= "博士学位 " then response.write "selected "%> > 博士学位 </option>
<option value=硕士学位 <%if rs( "ds_xl ")= "硕士学位 " then response.write "selected "%> > 硕士学位 </option>
<option value=学士学位 <%if rs( "ds_xl ")= "学士学位 " then response.write "selected "%> > 学士学位 </option>
其中的
<option value=博士学位> 博士学位 </option>
<option value=硕士学位> 硕士学位 </option>
<option value=学士学位> 学士学位 </option>
是运用application( "xuewei ")方式从数据库生成的!
方法如下:
sql= "select xuewei from [daima] xuewei is not null order by id asc "
rs.open sql,conn,1,1
for x=1 to rs.recordcount
xuewei = xuewei & " <option value= "&rs( "xuewei ")& "> "&rs( "xuewei ")& " </option> "
rs.movenext
next
rs.close
application( "xuewei ") = xuewei '学位
------解决方案--------------------sql= "select xuewei from [daima] xuewei is not null order by id asc "
rs.open sql,conn,1,1
Response.Write " <select name= " "xl " "> " & Chr(13) & Chr(10)
for x=1 to rs.recordcount
'xuewei = xuewei & " <option value= "&rs( "xuewei ")& "> "&rs( "xuewei ")& " </option> "
If rs( "xuewei ") = "博士学位 " Then
Response.Write " <option value= " " "& rs( "xuewei ") & " " " checked> " & rs( "xuewei ") & " </option> " & Chr(13) & Chr(10)
Else
Response.Write " <option value= " " "& rs( "xuewei ") & " " "> " & rs( "xuewei ") & " </option> " & Chr(13) & Chr(10)
End If
If rs( "xuewei ") = "硕士学位 " Then
Response.Write " <option value= " " "& rs( "xuewei ") & " " " checked> " & rs( "xuewei ") & " </option> " & Chr(13) & Chr(10)
Else
Response.Write " <option value= " " "& rs( "xuewei ") & " " "> " & rs( "xuewei ") & " </option> " & Chr(13) & Chr(10)
End If
If rs( "xuewei ") = "学士学位 " Then
Response.Write " <option value= " " "& rs( "xuewei ") & " " " checked> " & rs( "xuewei ") & " </option> " & Chr(13) & Chr(10)
Else
Response.Write " <option value= " " "& rs( "xuewei ") &