标题:asp提取下拉列表框的值作为连接不同数据库的条件
取消只看楼主
dahui
Rank: 1
等 级:新手上路
帖 子:7
专家分:0
注 册:2011-3-8
结帖率:0
已结贴  问题点数:10 回复次数:0 
asp提取下拉列表框的值作为连接不同数据库的条件
<%
tj=request("sel1")
if len(trim(tj))=4 then
%>
<%
Conn = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
     "Data Source=" & Server.MapPath("zhanghao.mdb")
      set rs=server.createobject("adodb.recordset")
      sql="select * from yuangong"
      rs.open sql,conn,1,1
  if rs.EOF or rs.BOF then
    Response.Write "<hr>数据库中没有记录"
  else
    do while not rs.EOF
%>
    <table border=1 align=center bordercolor=#0099cc cellspacing=0 cellpadding=4>
      <tr>
        <td width=220 align=center>序号</td>
          <td align=center width=40><font face="Arial, Helvetica, sans-serif"><%=rs("序号id")%></font></td>
          <td width=260><font face="Arial, Helvetica, sans-serif">口令:<%=rs("用户口令")%></font></td>
      <tr><td colspan=2><font face="Arial, Helvetica, sans-serif">姓名:<%=rs("用户姓名")%></font></td>      
          <td><font face="Arial, Helvetica, sans-serif">密码:<%=rs("用户密码")%></font></td>
      <tr><td colspan=2><font face="Arial, Helvetica, sans-serif">职务:<%=rs("职务")%></font></td>
          <td><font face="Arial, Helvetica, sans-serif">电话:<%=rs("备注")%></font></td>   
      </tr></table>
<%
      rs.movenext
    loop
  end if
  set rs=nothing
%>
  <%
  if len(trim(tj))=2  then
  Conn = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
     "Data Source=" & Server.MapPath("zhanghao.mdb")
      set rs=server.createobject("adodb.recordset")
      sql="select * from lingdao"
      rs.open sql,conn,1,1
  if rs.EOF or rs.BOF then
    Response.Write "<hr>数据库中没有记录"
  else
    do while not rs.EOF
%>
    <table border=1 align=center bordercolor=#0099cc cellspacing=0 cellpadding=4>
      <tr>
        <td width=220 align=center>序号</td>
          <td align=center width=40><font face="Arial, Helvetica, sans-serif"><%=rs("序号id")%></font></td>
          <td width=260><font face="Arial, Helvetica, sans-serif">口令:<%=rs("用户口令")%></font></td>
      <tr><td colspan=2><font face="Arial, Helvetica, sans-serif">姓名:<%=rs("用户姓名")%></font></td>      
          <td><font face="Arial, Helvetica, sans-serif">密码:<%=rs("用户密码")%></font></td>
      <tr><td colspan=2><font face="Arial, Helvetica, sans-serif">职务:<%=rs("职务")%></font></td>
          <td><font face="Arial, Helvetica, sans-serif">电话:<%=rs("备注")%></font></td>   
      </tr></table>
<%
      rs.movenext
    loop
  end if
  set rs=nothing
 
 end if
  %>
 
搜索更多相关主题的帖子: 数据库 
2011-03-26 14:27



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-334814-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.173109 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved