如何构造这个字符串?
<%
Function banzhu(banzhuid)
set rsadmin = Server.CreateObject( "adodb.recordset ")
rsadmin.open "select * from admin where admin_id = " & admin_id,conn,1,1
if rsadmin.eof then
else
banzhu = banzhu + " <select name=banzhu id=banzhu> <option value= " & rsadmin( "admin_name ") & & "> " & rsadmin( "admin_name ") & " </option> "
set rsteacher = Server.CreateObject( "adodb.recordset ")
rsteacher.open "select * from School_teacher where admin_sire = " & admin_id,conn,1,1
if rsteacher.eof then
else
do while not rsteacher.eof
banzhu = banzhu + " <option value= " & rsteacher( "Teacher_name ") & "> " & rsteacher( "Teacher_name ") & " </option> "
rsteacher.movenext
loop
end if
rsteacher.close
set rsteacher = nothing
end if
rsadmin.close
set rsadmin=nothing
banzhu = banzhu + " </select> "
End Function
%>
如果传入的banzhuid值等于rsadmin( "admin_id ")的话,那么就选中这行!应该如何写在上头的代码中?谢谢!
------解决方案--------------------do while not rsteacher.eof
if banzhuid=rsadmin( "admin_id ") then
banzhu = banzhu + " <option value= " & rsteacher( "Teacher_name ") & " selected> " & rsteacher( "Teacher_name ") & " </option> "
else
banzhu = banzhu + " <option value= " & rsteacher( "Teacher_name ") & " > " & rsteacher( "Teacher_name ") & " </option> "
end if
rsteacher.movenext
loop
------解决方案--------------------do while not rsteacher.eof
banzhu = banzhu + " <option value= " & rsteacher( "Teacher_name ") (anzhuid=rsadmin( "admin_id "))? "selected ": " " & " > " rsteacher( "Teacher_name ") & " </option> "
rsteacher.movenext
loop