
asp中,在select中实现循环出错
<selectsize='1'name='SalesExperienceID'class=droplist><%dowhilenotrstemp.EOFifrstemp....
<select size='1' name='SalesExperienceID' class=droplist>
<%
do while not rstemp.EOF
if rstemp.Fields("typeid")=rs1("SalesExperienceID") then
%>
<option value="<%=rstemp.Fields("typeid")%> " selected><%=rstemp.Fields("typename")%></option>
<%
else
%>
<option value="<%=rstemp.Fields("typeid")%>" ><%=rstemp.Fields("typename")%></option>
<%
end if
rstemp.MoveNext
loop
rstemp.Close
%>
</select>
运行到这边之后,下拉框中是空的没有选项。这个sql语句确定能在数据库中查找到对应数据,rs1("SalesExperienceID")也确定存在。求大神告知是什么问题,如何解决。万分感谢! 展开
<%
do while not rstemp.EOF
if rstemp.Fields("typeid")=rs1("SalesExperienceID") then
%>
<option value="<%=rstemp.Fields("typeid")%> " selected><%=rstemp.Fields("typename")%></option>
<%
else
%>
<option value="<%=rstemp.Fields("typeid")%>" ><%=rstemp.Fields("typename")%></option>
<%
end if
rstemp.MoveNext
loop
rstemp.Close
%>
</select>
运行到这边之后,下拉框中是空的没有选项。这个sql语句确定能在数据库中查找到对应数据,rs1("SalesExperienceID")也确定存在。求大神告知是什么问题,如何解决。万分感谢! 展开
1个回答
展开全部
根据你代码中的
if
else
end if ,
如果说sql语句确定能查找到数据,那应该能显示在 <select>中。
除非出现asp代码错误,导致无法显示到<select>中
rs1("SalesExperienceID") 这个值是 int 型?
rstemp.Fields("typeid") 也是 int 型?
<%
currentSalesExperienceID = rs1("SalesExperienceID") '可以先把这个值先提出取来
do while not rstemp.EOF
if rstemp.Fields("typeid")=currentSalesExperienceID then
%>
if
else
end if ,
如果说sql语句确定能查找到数据,那应该能显示在 <select>中。
除非出现asp代码错误,导致无法显示到<select>中
rs1("SalesExperienceID") 这个值是 int 型?
rstemp.Fields("typeid") 也是 int 型?
<%
currentSalesExperienceID = rs1("SalesExperienceID") '可以先把这个值先提出取来
do while not rstemp.EOF
if rstemp.Fields("typeid")=currentSalesExperienceID then
%>
追问
rs1("SalesExperienceID"),rstemp.Fields("typeid")这两个值都是int型的,刚在数据库里查的。rs1("SalesExperienceID")这个值是0

2022-08-05 广告
苏州蓝晓生物科技有限公司。标准化核心产品:公司拥有完整的琼脂糖介质、葡聚糖介质、聚甲基丙烯酸酯介质生产线,年产分离介质50000L,产品质量稳定并达到国际领先水平。核心优势:公司核心技术人员拥有近二十年不同基质的基球开发和官能化的丰富技术经...
点击进入详情页
本回答由苏州蓝晓生物科技有限公司_提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询