如题
解决方案 »
- asp.net C#如何访问局域网下面的目录与文件
- 如何将cs封装为一个DLL并引用的简单问题
- 求asp.net版的eWebEditor编辑器(在线的不要)
- 如何用ASP.NET打开本地WORD文档
- $$$如何一次在子窗口中刷新父窗口多个框架中的网页内容
- (深圳)金蝶一般考试考什么啊?.NET方向的,有谁知道啊!
- 如何将从数据库中读出的数据绑定到DropDownList上?
- 关于asp.net应用程序中自动定时刷新数据的问题
- json二级联动下拉列表根据读取的数据值进行选中状态
- 如何验证textbox里输入的是符合日期型的字符串?
- 这个webconfig怎么设置
- 新手提问--地址栏中不显示默认页的名字
得到目录树子级的所有的分类SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GOCREATE function f_getChild(@ID VARCHAR(1000))
returns @t table(ID int,parentid int,[Name] nvarchar(20) ,[Description] ntext, Icon nvarchar(60) , Visible bit,IsAggregated bit,myOrder int,AddTime datetime,UpdateTime datetime,Depth int,Level INT)
as
begin
declare @i int
set @i = 1
insert into @t select ID,parentid,[Name],[Description],Icon,Visible,IsAggregated,myOrder,AddTime,UpdateTime,Depth,@i from vd_category a where parentid = @ID
while @@rowcount<>0
begin
set @i = @i + 1
insert into @t
select
a.[ID],a.parentid,a.[Name],a.[Description],a.Icon,a.Visible,a.IsAggregated,a.myOrder,a.AddTime,a.UpdateTime,a.Depth,@i
from
vd_category a,@t b
where
a.parentid=b.ID and b.Level = @i-1
end
return
end
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
1 0
2 03 0,1
4 0,1
5 0,1,3
6 0,1,3
应该能够看出来吧,5的父节点是 3 ,5的父节点是 1 。0
1
3
5
6
4
2
那么我想显示 1的所有节点,加一个 like 就可以了 , like '0,1%'。简单吧。
一:获取当前节点的所有子节点(包括子孙节点)的id
所有的id用","分隔(包括当前节点)
二: select * from news where newstypeid in(2,5,7,9) 形式来获取
http://hi.baidu.com/alby/blog/item/20bd33fae9c6181ea8d311b2.html