- USE [test_YTHH]
- GO
- /****** Object: StoredProcedure [dbo].[usp_Print_SCC_Menu] Script Date: 04/08/2013 11:21:23 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- ——————————–
- –简易输出Sys菜单
- —BY HXL
- —20136–04–08
- ——————————–
- CREATE PROC [dbo].[usp_Print_Sys_Menu]
- AS
- BEGIN
- DECLARE @parentID INT
- DECLARE @text NVARCHAR(20)
- DECLARE @value CHAR(7)
- DECLARE @text2 NVARCHAR(20)
- DECLARE @value2 CHAR(7)
- DECLARE p_cur CURSOR FOR SELECT FunctionName,FunctionCode,FunctionID FROM dbo.[Function] WHERE ParentID = 6001 AND FunctionType = 1
- OPEN p_cur
- FETCH NEXT FROM p_cur INTO @text,@value ,@parentID
- WHILE @@FETCH_STATUS = 0
- BEGIN
- –父菜单
- PRINT ‘ <Menu id=”‘+@value+‘” text=”‘+@text+‘” iconCls=”Frame_Main_icon11″>’
- –子菜单
- DECLARE sub_cur CURSOR FOR SELECT FunctionName,CAST(FunctionCode AS NVARCHAR(20)) FROM dbo.[Function] WHERE ParentID = @parentID AND FunctionType = 2
- OPEN sub_cur
- FETCH NEXT FROM sub_cur INTO @text2,@value2
- WHILE @@FETCH_STATUS = 0
- BEGIN
- PRINT ‘ <Menu id=”‘+@value2+‘” pid=”‘+@value+‘” text=”‘+@text2+‘” url=”../DBM/”></Menu> ‘
- FETCH NEXT FROM sub_cur INTO @text2,@value2
- END
- CLOSE sub_cur
- DEALLOCATE sub_cur
- PRINT ‘</Menu>’
- FETCH NEXT FROM p_cur INTO @text,@value,@parentID
- END
- –关闭游标
- CLOSE p_cur
- –释放资源
- DEALLOCATE p_cur
- END
- 转载自:http://www.aspnetjia.com/Cont-49.html
时间: 2024-10-14 14:05:39