| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1324 人关注过本帖
标题:纯ASP四级联动结合ACCESS数据库
取消只看楼主 加入收藏
smh4037
Rank: 1
等 级:新手上路
帖 子:20
专家分:0
注 册:2008-6-21
收藏
 问题点数:0 回复次数:1 
纯ASP四级联动结合ACCESS数据库
纯ASP四级联动....有没有更好的办法

这个还有一点缺陷,,,,,,,

|中国区域|省|市|县|

<!--#include file="../conn/conn.asp"-->
<%

Function SercahDei(Deiid,shengid,shiid,xiangid)
 If Deiid = "" Then
    Deiid = 1
 Else
    Deiid  = Int(Deiid)
 End If
 Str    = "<form action='' method='post' name='form1'>"
 Set rs = Server.CreateObject("ADODB.RecordSet")
 Sql    = "Select * From MT_sshqdei"
 rs.Open Sql,conn,1,1
 Str = Str &"<select name='deiid' onchange=document.form1.submit();>"
 Do While Not rs.Eof
 If Deiid = rs("id") then
 Str = Str &"<option value="&rs("id")&" selected>"&rs("deiname")&"</option>"
 else
 Str = Str &"<option value="&rs("id")&">"&rs("deiname")&"</option>"
 end if
 rs.MoveNext    
 Loop
 Str = Str &"</select>"
      If shengid = "" Then
         shengid = 1
      Else
         shengid = Int(shengid)
      End If
        Set rs1  = Server.CreateObject("ADODB.RecordSet")
        Sql      = "Select * From MT_province Where deiid="&Deiid
        rs1.Open Sql,conn,1,1
        If rs1.Eof And rs1.Bof Then
        Str = Str &""
        Else
        Str = Str &"<select name='shengid' onchange=document.form1.submit();>"
        Do While Not rs1.Eof
        if shengid = rs1("id") then
        Str = Str &"<option value="&rs1("id")&" selected>"&rs1("shengname")&"</option>"
        else
        Str = Str &"<option value="&rs1("id")&">"&rs1("shengname")&"</option>"
        end if
        rs1.MoveNext
        Loop
        Str = Str &"</select>"
        End If
        rs1.Close
        Set rs1 = Nothing
        
        
        
        
              If shiid = "" Then
                 shiid = 1
              Else
                 shiid  = Int(shiid)
              End If
        Set rs1 = Server.CreateObject("ADODB.RecordSet")
        Sql    = "Select * From MT_city Where shengid="&shengid&" and deiid="&Deiid
        rs1.Open Sql,conn,1,1
        If rs1.Eof And rs1.Bof Then
        Str = Str &""
        Else
        Str = Str &"<select name='shiid' onchange=document.form1.submit();>"
        Do While Not rs1.Eof
        if shiid = rs1("id") then
        Str = Str &"<option value="&rs1("id")&" selected>"&rs1("shiname")&"</option>"
        else
        Str = Str &"<option value="&rs1("id")&">"&rs1("shiname")&"</option>"
        end if
        rs1.MoveNext
        Loop
        Str = Str &"</select>"
        End If
        rs1.Close
        Set rs1 = Nothing
        
        
        
        
        
              If xiangid = "" Then
                 xiangid = 1
              Else
                 xiangid  = Int(xiangid)
              End If
        Set rs1 = Server.CreateObject("ADODB.RecordSet")
        Sql    = "Select * From MT_xiang Where shiid="&shiid&" and deiid="&Deiid
        rs1.Open Sql,conn,1,1
        If rs1.Eof And rs1.Bof Then
        Str = Str &""
        Else
        Str = Str &"<select name='xiangid' onchange=document.form1.submit();>"
        Do While Not rs1.Eof
        if xiangid = rs1("id") then
        Str = Str &"<option value="&rs1("id")&" selected>"&rs1("xiangname")&"</option>"
        else
        Str = Str &"<option value="&rs1("id")&">"&rs1("xiangname")&"</option>"
        end if
        rs1.MoveNext
        Loop
        Str = Str &"</select>"
        End If
        rs1.Close
        Set rs1 = Nothing

      
 rs.Close
 Set rs = Nothing
 Str    = Str &"</form>"
 SercahDei = Str
 End Function

deiid    = Trim(Request.Form("deiid"))
shengid  = Trim(Request.Form("shengid"))
shiid    = Trim(Request.Form("shiid"))
xiangid  = Trim(Request.Form("xiangid"))

Response.Write SercahDei(Deiid,shengid,shiid,xiangid)
Response.Write Deiid&","&shengid&","&shiid&","&xiangid
%>

四级联动(纯ASP).jpg (5.29 KB)
图片附件: 游客没有浏览图片的权限,请 登录注册
搜索更多相关主题的帖子: 四级 数据库 ACCESS ASP 中国 
2008-06-21 22:23
smh4037
Rank: 1
等 级:新手上路
帖 子:20
专家分:0
注 册:2008-6-21
收藏
得分:0 
不懂JS,所以才做得这么麻烦
2008-06-24 20:50
快速回复:纯ASP四级联动结合ACCESS数据库
数据加载中...
 
   



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

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