asp中,用session的获取值作为条件查询数据库 就是"<%=Session("DANWEI")%>"作为条件
<selectsize="1"name="MajorName"id="id_MajorName"><scriptlanguage="javascript"type="te...
<select size="1" name="MajorName" id="id_MajorName">
<script language="javascript" type="text/javascript">
var aa=("<%=Session("DANWEI")%>");
</script>
<%
Set rs = Server.CreateObject("ADODB.Recordset")
SQL="SELECT * FROM danwei where danwei='"&aa&"' ORDER BY id ASC"
rs.open sql,Conn,1,1
if rs.eof then
%>
<option selected value="">选择车号</option>
<%else%>
<option selected value="">选择车号</option>
<%for i=2 to rs.fields.count-1%>
<option value="<%=rs(i).value%>" <%if Request("MajorName")<>"" and Request("MajorName")=rs("ch") then%> selected <%end if%> name=unit><%=rs(i).value%></option>
<%
next
end if
rs.close
set rs=nothing
%>
</select>
这样没有结果,不知道错在哪,请高手指点 展开
<script language="javascript" type="text/javascript">
var aa=("<%=Session("DANWEI")%>");
</script>
<%
Set rs = Server.CreateObject("ADODB.Recordset")
SQL="SELECT * FROM danwei where danwei='"&aa&"' ORDER BY id ASC"
rs.open sql,Conn,1,1
if rs.eof then
%>
<option selected value="">选择车号</option>
<%else%>
<option selected value="">选择车号</option>
<%for i=2 to rs.fields.count-1%>
<option value="<%=rs(i).value%>" <%if Request("MajorName")<>"" and Request("MajorName")=rs("ch") then%> selected <%end if%> name=unit><%=rs(i).value%></option>
<%
next
end if
rs.close
set rs=nothing
%>
</select>
这样没有结果,不知道错在哪,请高手指点 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询