作者:北京草舞945share | 来源:互联网 | 2018-05-31 03:38
利用ACCESS创建数据库listBase.mdb:数据表:listTable数据字段:listIdlistNamelistInfoparentId连接方法:%dimsConn,sConnStr,sSqlsConnStrDRIVER{MicrosoftAccessDriver(*.mdb)};dbqserver.mappath(listBase.mdb)setsConnserver.createobjec
利用ACCESS创建数据库listBase.mdb: 数据表:listTable 数据字段:listIdlistNamelistInfoparentId 连接方法: % dimsConn,sConnStr,sSql sCOnnStr="DRIVER={MicrosoftAccessDriver(*.mdb)};dbq="server.mappath("listBase.mdb") setsCOnn=server.createobjec
利用ACCESS创建数据库listBase.mdb:
数据表:listTable
数据字段:listIdlistNamelistInfoparentId 连接方法:
<%
dimsConn,sConnStr,sSql
sCOnnStr="DRIVER={MicrosoftAccessDriver(*.mdb)};dbq="&server.mappath("listBase.mdb")
setsCOnn=server.createobject("adodb.connection")
sConn.opensConnStr
%>
把以上代码保存成文件:initialize.asp 下面这段程序代码是用来显示
目录树用的,保存成文件:inc.asp
<%
response.write("
" & chr(13))
response.write("" & chr(13)&"" & chr(13) & "")
response.write("" & chr(13) & " response.write(" | " & chr(13))
response.write(" | |
" & chr(13))
response.write("" & chr(13) & "
" & chr(13))
'下面代码为显示
目录树最关键的函数,
使用了递归方法(很多象这样类型的都是用递归来做的。)
function listChild(id)
dim sRec,sSql,sNum,sTmp
set sRec=server.createobject("adodb.recordset")
sSql="select listId,listName,listInfo,parentId from listTable where parentId=" & id
sRec.open sSql,sConn,3,1
if not sRec.eof then
sNum=1
response.write("
" & chr(13))
while not sRec.eof
sTmp=sConn.execute("select count(listId) as countSub from listTable where parentId=" & sRec("listId"))
if sTmp("countSub")>0 then
response.write("" & chr(13))
if sNum=sRec.recordcount then
response.write(" | " & chr(13))
else
response.write(" | " & chr(13))
end if
response.write("" & chr(13) & "" & chr(13))
response.write("" & chr(13) & " " & chr(13))
else
response.write("" & chr(13))
if sNum=sRec.recordcount then
response.write(" | " & chr(13))
else
response.write(" | " & chr(13))
end if
response.write("" & chr(13) & "" & chr(13))
response.write("" & chr(13) & "" & chr(13) & " " & chr(13))
end if
sRec.close '关闭记录集
set sRec=nothing '关闭记录集
end function
sConn.close '关闭数据库链接
set sCOnn=nothing '关闭数据库链接
%>
下面这是调用页代码,保存成index.asp
<%@LANGUAGE='Vbscript' CODEPAGE='936'%>
下面是提交信息处理页的代码,保存为disp.asp
<%
function checkstr(str)
str=replace(str,"'","''",1,-1,1)
checkstr=str
end function
dim disp,parentId,listName,listInfo
disp=request.QueryString("disp")
parentId=request.QueryString("parentId")
select case disp
case "add"
listName=checkstr(left(request.QueryString("listName"),10))
listInfo=checkstr(left(request.QueryString("listInfo"),50))
if listName="" then listName="空白节点"
if listInfo="" then ListInfo="此节点在添加入未填写内容"
sSql="insert into listTable (listName,listInfo,parentId) values('" & listName & "','" & listInfo & "'," & parentId & ")"
case "edit"
listName=checkstr(left(request.QueryString("listName"),10))
listInfo=checkstr(left(request.QueryString("listInfo"),50))
if listName="" then listName="空白节点"
if listInfo="" then listInfo="此节点在添加入未填写内容"
sSql="update listTable set listName='" & listName & "',listInfo='" & listInfo & "' where listId=" & parentId
case "del"
sSql="delete from listTable where listId=" & parentId & " or parentId=" & parentId
end select
sConn.execute sSql,,1
response.redirect("index.asp")
%> 以上代码保存成的文件放在同一目录下面(在这里我们称为根目录)。
在根目录下新建一个CSS目录.
下面为CSS定义,保存成css.css文件,放在CSS目录下。注:有一两个样式是不要的,我没删
.menuPro{
border-top:1pxdotted#A5BBE0;
border-right:1pxdotted#31548E;
border-bottom:1pxdotted#31548E;
border-left:1pxdotted#A5BBE0;
overflow:visible;
font-family:"Verdana","Arial","Helvetica","sans-serif";
font-size:12px; }
.menuGro{
border-top:2pxoutset#31548E;
border-right:2pxoutset#A5BBE0;
border-bottom:2pxoutset#A5BBE0;
border-left:2pxoutset#31548E;
overflow:visible;
font-family:"Verdana","Arial","Helvetica","sans-serif";
font-size:12px;
}
.menuFont{
font-family:"Verdana","Arial","Helvetica","sans-serif";
font-size:12px;
}
.showDiv{
display:'';
}
.hiddenDiv{
display:none;
}
.treeDiv{
background-color:#A8D5EA;
height:100%;
width:100%;
border-top-width:2px;
border-right-width:2px;
border-bottom-width:2px;
border-left-width:2px;
border-top-style:inset;
border-right-style:inset;
border-bottom-style:inset;
border-left-style:inset;
border-top-color:#3680C9;
border-right-color:#BCD5ED;
border-bottom-color:#BCD5ED;
border-left-color:#3680C9;
overflow:auto;
padding:20px;
}
body{
overflow:hidden;
}
.formDiv{
font-family:"Verdana","Arial","Helvetica","sans-serif";
font-size:12px;
font-weight:normal;
background-color:#7ABDDE;
height:200px;
width:300px;
border-top:1pxoutset#B9DCFF;
border-right:1pxoutset#004488;
border-bottom:1pxoutset#004488;
border-left:1pxoutset#B9DCFF;
overflow:hidden;
}
.text1{
width:160px;
}
.DivBut{
font-family:"Verdana","Arial","Helvetica","sans-serif";
font-size:12px;
font-weight:normal;
background-color:#3399CC;
height:20px;
width:40px;
border:1pxoutset; }
另在根目录下建一个IMAGES目录。用来放那些文件夹样子的小图。 打包下载[请使用WINRAR3.0解压]:小图片
推荐阅读
-
JavaScript在常人看来都是门出不了厅堂的小语言,仅管它没有明星语言的闪耀,但至少网页的闪耀还是需要它的,同时它是一门很实用的语言,本人平时就喜欢拿它来写点实用工具或应用,本文演示用JavaSc ...
[详细]
蜡笔小新 2023-10-13 09:49:41
-
Iwouldliketobeabletohaveasidebarthatcanbetoggledinandoutonabuttonpress.However ...
[详细]
蜡笔小新 2023-10-13 12:28:22
-
-
我试图制作一个进度条,如果还有更多内容仍被隐藏,则显示箭头。为了更清楚,我做 ...
[详细]
蜡笔小新 2023-10-12 19:31:36
-
本文详细介绍了CSS3新增的选择器方法,包括属性选择器的使用。通过CSS3选择器,可以提高Web开发的效率和精准度,使得查找元素更加方便和快捷。同时,本文还对属性选择器的各种用法进行了详细解释,并给出了相应的代码示例。通过学习本文,读者可以更好地掌握CSS3选择器的使用方法,提升自己的Web开发能力。 ...
[详细]
蜡笔小新 2023-12-14 14:37:52
-
在说Hibernate映射前,我们先来了解下对象关系映射ORM。ORM的实现思想就是将关系数据库中表的数据映射成对象,以对象的形式展现。这样开发人员就可以把对数据库的操作转化为对 ...
[详细]
蜡笔小新 2023-12-14 10:57:47
-
本文介绍了一个在线急等问题解决方法,即如何统计数据库中某个字段下的所有数据,并将结果显示在文本框里。作者提到了自己是一个菜鸟,希望能够得到帮助。作者使用的是ACCESS数据库,并且给出了一个例子,希望得到的结果是560。作者还提到自己已经尝试了使用"select sum(字段2) from 表名"的语句,得到的结果是650,但不知道如何得到560。希望能够得到解决方案。 ...
[详细]
蜡笔小新 2023-12-13 15:15:30
-
本文提供了30条关于优化SQL的建议,包括避免使用select *,使用具体字段,以及使用limit 1等。这些建议是基于实际开发经验总结出来的,旨在帮助读者优化SQL查询。 ...
[详细]
蜡笔小新 2023-12-13 13:24:33
-
本文介绍了Linux环境变量$PATH的作用及使用方法。$PATH是一个由多个目录组成的变量,用冒号分隔。当执行一个指令时,系统会按照$PATH定义的目录顺序搜索同名的可执行文件,如果有多个同名指令,则先找到的会被执行。通过设置$PATH变量,可以在任何地方执行指令,无需输入绝对路径。 ...
[详细]
蜡笔小新 2023-12-10 15:26:56
-
loader资源模块加载器webpack资源模块加载webpack内部(内部loader)默认只会处理javascript文件,也就是说它会把打包过程中所有遇到的 ...
[详细]
蜡笔小新 2023-10-17 21:26:42
-
本文目录一览:1、如何在IIS中执行Python脚本 ...
[详细]
蜡笔小新 2023-10-17 19:41:52
-
vb.net面试题,请大家帮忙,谢谢。如果需要讲详细一点,那就加我QQ531412815第4题,潜在的错误,这里的错误不是常规错误,属于那种只有在运行是才知道的错误:Catchex ...
[详细]
蜡笔小新 2023-10-17 12:43:37
-
但有时候,需要当某事件触发时,我们先做一些操作,然后再跳转,这时,就要用JAVASCRIPT来实现这一跳转功能。下面是具体的做法:一:跳转到新页面,并且是在新窗口中打开时:复制代码代码如下:fu ...
[详细]
蜡笔小新 2023-10-13 12:25:13
-
ImgettingabugwithInternetExplorer.Theiframedoesnthavecorrectsizeanditisdisplayedo ...
[详细]
蜡笔小新 2023-10-12 20:54:23
-
8种机械键盘轴体对比本人程序员,要买一个写代码的键盘,请问红轴和茶轴怎么选?THML中常见的8种长度1、常见的单位px:像素 ...
[详细]
蜡笔小新 2023-09-24 09:43:18
-
本文主要介绍关于人工智能,shell的知识点,对【winyyy.sys,hcpidesk.sys,mtlrd.sys,uldfhjfh.sys,servets.exe等1】和【】有兴趣的朋友可以看下由 ...
[详细]
蜡笔小新 2023-09-23 16:17:58
-
北京草舞945share
这个家伙很懒,什么也没留下!
| |