當前位置:首頁 » 操作系統 » 資料庫級聯菜單

資料庫級聯菜單

發布時間: 2022-03-05 18:36:03

A. sql級聯查詢 商品類型級聯菜單查詢

就是幾個表單的聯合查詢,不難的。所有關聯欄位link起來就好了。因為你的問題裡面就講到了關聯的欄位,無法給出具體的sql語句。你可以hi我,告訴你詳細的操作

B. 二級聯動菜單,從資料庫中讀取,並顯示相應的值。該怎麼寫

二級別聯動菜單建議使用ajax寫。

C. 怎樣與SQL資料庫連接用ASP做一個三級聯動菜單

建一個表fenlei,包括欄位如下:
id,name,level,follow

id為標識[自動編號]
name為分類名稱[字元]
level為分類級別[數字,不可為空]
follow為從屬於哪個分類[數字,默認為0]

假設表中內容為:
id | name | level | follow
1 | biga | 1 | 0
2 | bigb | 1 | 0
3 | sa | 2 | 1
4 | ssa | 3 | 3

sql="select * from fenlei where level = 1 and follow =0"
set rs=conn.execute(sql)
do while not rs.eof
response.write rs("id")&"."&rs("name")&"<br>"
sql1="select * from fenlei where level = 2 and follow = "&rs("id")
set rs1=conn.execute(sql)
do while not rs1.eof
response.write rs("id")&"."&rs1("id")&"."&rs1("name")&"<br>"
sql2="select * from fenlei where level = 3 and follow = "&rs1("id")
rs2=conn.execute(sql)
do while not rs2.eof
response.write rs("id")&"."&rs1("id")&"."&rs2("id")&"."&rs2("name")&"<br>"
rs2.movenext
loop
rs1.movenext
loop
rs.movenext
loop

註:conn為資料庫連接
以上三個循環掌握住了以及資料庫中各記錄的關系掌握了就沒有大問題了,具體代碼的問題請參考你的教科書。哦呵呵呵~

D. 動態級聯菜單怎麼實現的

方法1: 用Css實現
<html>
<head>
<title>css菜單顯示效果</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript">
/**
*菜單的構造,需要綁定到onload
*/
startList = function() {
if (document.all&&document.getElementById) {
navRoot = document.getElementById("nav");
for (i=0; i<navRoot.childNodes.length; i++) {
node = navRoot.childNodes[i];
if (node.nodeName=="LI") {
node.onmouseover=function() {
this.className+=" over";
}
node.onmouseout=function() {
this.className=this.className.replace(" over", "");
}
}
}
}
}
window.onload=startList;
</script>
<style type="text/css" media="all">
/**
子烏的葉子css:主樣式表
這個樣式表的結構參考了<a href="http://www.zeldman.com">zeldman</a>的樣式表結構
update:05.11.18
author:sheneyan
*/

html {min-width: 742px;}

/*css基本規則*/
img{border:0;}
p.access {display:none;}
div#counters{display:none;}/*計數器暫時不顯示*/
a{text-decoration: none;}
/* 主要布局 */
body{
overflow:auto;
text-align: center;
margin: 0 auto;
padding: 0;
border: 0;
background: #fff;
color: #000;
font: small/18px "宋體", Verdana, Helvetica, sans-serif;
}
/**菜單的控制,根據<a href="http://www.alistapart.com/d/horizdropdowns/horizontal2.htm">css 菜單</a>修改而來*/
ul#nav,ul#nav ul{
margin: 0 auto;
text-align:left;
padding: 0;
list-style: none;
background:#fff;
z-index:99;
}
ul#nav {
width:732px;
display:block;
height:24px;
clear:both;
}

ul#nav li {
position: relative;
z-index:999;
float:left;
}
ul#nav ul li{
display:block;
}
ul#nav ul {
width:100px;
height:auto;
position: absolute;
text-align:left;
left: 0px;
display: none;
border:solid 1px #697210;
}

/*當滑鼠在子菜單和父菜單上時,父菜單的樣式*/
ul#nav li.over a,ul#nav li:hover a{
border-color:#E2144A;
background: #fdd;
font-weight:bold;
color: #E2144A;
}
/*將子菜單的樣式清除*/
ul#nav li.over ul a,ul#nav li:hover ul a{
background:#fff;
font-weight:normal;
color:#777;
}
/*子菜單的hover樣式*/
ul#nav li.over ul a:hover,ul#nav li:hover ul a:hover{
background:#fff;
font-weight:normal;
color: #E2144A;
background: #fdd;
border-color:#E2144A;
font-weight:bold;
}

/* Styles for Menu Items */
ul#nav a {
font-size:14px;
line-height:17px;
display: block;
padding:0 0 0 10px;
width:78px;
color: #777;
height:17px;
background: #fff;
border-left:solid 1px #fff;
border-top:solid 1px #fff;
border-right:solid 1px #fff;
border-bottom:solid 5px #697210;
}

ul#nav ul li{
width:100px;
border:0;
}
/* Fix IE. Hide from IE Mac \*/
* html ul#nav li { float: left; height: 17px; }
* html ul#nav li a { height: 17px; }
/* End */

ul#nav ul a { padding: 2px 0px 2px 10px;border:0;width:90px; } /* Sub Menu Styles */

ul#nav li:hover ul,ul#nav li.over ul { display: block; } /* The magic */
</style>
<body>
測試css菜單顯示效果<br/>
<!--菜單開始-->
<ul id='nav'>
<li><a href='/g.php/working.html'>文章</a>
<ul>
<li><a href='/g.php/working/29.html'>隨筆</a></li>
<li><a href='/g.php/working/30.html'>小說</a></li>
<li><a href='/g.php/working/31.html'>詩</a></li>
<li><a href='/g.php/working/32.html'>文摘</a></li>
</ul>
</li>
<li><a href='/g.php/pic.html'>美圖</a>
<ul>
<li><a href='/g.php/pic/19.html'>漫畫</a></li>
<li><a href='/g.php/pic/20.html'>攝影</a></li>
<li><a href='/g.php/pic/33.html'>CG作品</a></li>
<li><a href='/g.php/pic/41.html'>圖+文</a></li>
</ul>
</li>
<li><a href='#'>技術</a>
<ul>
<li><a href='/g.php/tech/tool/37.html'>在線工具</a></li>
<li><a href='/g.php/tech/collect/43.html'>代碼收集</a></li>
<li><a href='/g.php/tech/lab/44.html'>實驗室</a></li>
<li><a href='/g.php/tech/article/45.html'>技術文章</a></li>
</ul>
</li>
<li><a href='/g.php/fav.html'>網站收藏夾</a></li>
<li><a href='/g.php/working.html'>讀書筆記</a>
<ul>
<li><a href='/g.php/working/22.html'>哲學</a></li>
<li><a href='/g.php/working/23.html'>小說</a></li>
</ul>
</li>
<li><a href='/g.php/working.html'>日記</a>
<ul>
<li><a href='/g.php/working/27.html'>生活</a></li>
<li><a href='/g.php/working/28.html'>工作</a></li>
</ul>
</li>
<li><a href='#'>計劃</a>
<ul>
<li><a href='/g.php/todo/39.html'>計劃要做的事</a></li>
<li><a href='/g.php/tobuy/40.html'>計劃要買的</a></li>
</ul>
</li>
<li><a href='/g.php/working.html'>其他</a>
<ul>
<li><a href='/g.php/working/34.html'>關於本站</a></li>
<li><a href='/g.php/working/35.html'>留言</a></li>
<li><a href='/g.php/working/36.html'>友情鏈接</a></li>
</ul>
</li>
</ul><!--菜單結束-->
</Html>

E. 3級級聯菜單,國家。省份。城市。必須在SQL一個表中實現。我這樣寫的資料庫對嗎

這樣寫也是OK的,看你怎麼用吧。
還有一種寫法叫Hierarchical,使用遞歸方法。具體參見https://en.wikipedia.org/wiki/Hierarchical_and_recursive_queries_in_SQL

F. asp資料庫聯動菜單

補充一下:你的資料庫結構好像有問題
以前我在經典發過一個

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script language="JavaScript" src="selectarea.js"></script>
<title>藍木設計——省市縣三級地名資料庫自動聯動系統</title>
</head>

<body>
<select name="city1" id="city1" onChange="changepro('city2','city1');">
<option value="" selected>省/直轄市</option>
<%
Set Rs = GetRs("select code,b_class from class")
while not Rs.eof
Response.Write "<option value='" & Rs(0) & "'>" & Rs(1) & "</option>"
Rs.movenext
wend
Rs.Close
Set Rs = nothing
%>
</select>
<select name="city2" id="city2" onChange="changecity('city3','city2');">
<option value="">請選擇</option>
</select>
<select name="city3" id="city3">
<option value="">請選擇</option>
</select>
</body>
</html>

<script>
var lmcount;
var lmcount2;
lm=new Array();
lm2=new Array();
<%
i=0
Set Rs = GetRs("select m_class from class")
while not Rs.eof
Set Rs1 = GetRs("select s_class from class where 屬於上面中類的小類"
while not Rs1.eof
Response.Write "lm[" & i & "] = new Array('" & Rs1(0) & "','" & Rs(0) & "')"
Rs1.movenext
wend
count1 = Rs1.Recordcount
Rs1.Close
Set Rs1 = nothing
wend
count2 = Rs2.Recordcount
Rs.Close
Set Rs = nothing
%>

lmcount=<%=count1%>;
lmcount2=<%=count2%>;
function changepro(city,pro)
{
var city=city;
var pro=document.getElementById(pro).value;
var i;
document.getElementById(city).length=1;
for (i=0;i<lmcount;i++){
if (lm[i][1]==pro){
document.getElementById(city).options[document.getElementById(city).length]=new Option(lm[i][0], lm[i][0]);
}
}

}

function changecity(county,city)
{
var county=county;
var city=document.getElementById(city).value;
var j;
document.getElementById(county).length=1;
for (j=0;j<lmcount2;j++){
if (lm2[j][1]==city){
document.getElementById(county).options[document.getElementById(county).length]=new Option(lm2[j][0], lm2[j][0]);
}
}

}
</script>

G. 怎樣才能把三級聯動下拉菜單的值提交到資料庫有點急

這應該和聯動沒關系吧,獲取到頁面上選擇年,月,日的值和省,市,區的值拼一起寫入到資料庫的birthday和address應該就可以了吧。

H. 什麼是級聯式菜單

比如:開始菜單裡面有程序菜單,他下裡面又有附件菜單,附件又有系統工具等,這就是一個四級級聯菜單

I. MVC框架設計,我要做一個網上評教系統,關於題庫管理時,資料庫設計是這樣的;想做個級聯菜單,求高手指點

你的question_id記錄的是ID編號吧,可以採用jquery或ext,很方便

熱點內容
鴻蒙系統跟安卓到底有什麼區別 發布:2024-09-23 23:01:48 瀏覽:7
php自動斜杠 發布:2024-09-23 23:01:45 瀏覽:95
用c語言判斷一個數是不是素數 發布:2024-09-23 22:50:40 瀏覽:229
eclipse追加額外編譯條件 發布:2024-09-23 21:59:51 瀏覽:695
sql增加表數據 發布:2024-09-23 21:58:57 瀏覽:319
蘋果手機如何看保存的密碼是多少 發布:2024-09-23 21:47:47 瀏覽:432
ftp年日均存款 發布:2024-09-23 21:47:36 瀏覽:840
最好用的雲伺服器 發布:2024-09-23 21:42:07 瀏覽:617
mac訪問win7共享文件夾 發布:2024-09-23 21:30:02 瀏覽:714
雙系統怎麼查win的配置 發布:2024-09-23 21:25:48 瀏覽:814