select 多选框读取数据库问题
发布网友
发布时间:2022-05-10 18:11
我来回答
共4个回答
热心网友
时间:2023-10-21 01:54
<select name="sellman" size="5" multiple class="unnamed1" id="sellman">
<%
set rs1=conn.execute("select * from ywy where ting=1 and yglx='ywy' order by list asc")
do while not rs1.eof
%>
<option value="<%=rs1("ywy")%>" <%if InStr(rs("fjman"),rs1("ywy"))>0 then Response.Write("selected")%> >:::<%=rs1("ywy")%>:::</option>
<%
rs1.movenext
loop
rs1.close
%>
</select>
试试这个~rs("fjman")包含多个sellman的值即是这样
热心网友
时间:2023-10-21 01:55
<select name="sellman" size="5" multiple class="unnamed1" id="sellman">
<%
t = Trim(rs("fjman"))
set rs1=conn.execute("select * from ywy where ting=1 and yglx='ywy' order by list asc") '读取全部人员
do while not rs1.eof
'-------------------
if StrComp(Trim(rs1("ywy")), t, 1) = 0 then
'---------------
%>
<option value="<%=rs1("ywy")%>" selected>:::<%=rs1("ywy")%>:::</option>
<%else%>
<option value="<%=rs1("ywy")%>">:::<%=rs1("ywy")%>:::</option>
<%end if
rs1.movenext
loop
rs1.close
%>
</select>
建议比较前都经过 Trim处理掉前后空格...
很多时候...经常会因为这个前后空格出现点儿啥问题..
热心网友
时间:2023-10-21 01:55
<%
set rs1=conn.execute("select * from ywy where ting=1 and yglx='ywy' order by list asc")
do while not rs1.eof
if instr(rs("fjman"),rs1("ywy"))>0 then '这里怎么写?
%>
<option value="<%=rs1("ywy")%>" selected>:::<%=rs1("ywy")%>:::</option>
<%else%>
<option value="<%=rs1("ywy")%>">:::<%=rs1("ywy")%>:::</option>
<%end if
rs1.movenext
loop
rs1.close
%>
热心网友
时间:2023-10-21 01:56
不知道你rs("fjman")这个从哪里来的