获取属性列表的Html代码
Code
1 set ANSI_NULLS ON
2 set QUOTED_IDENTIFIER ON
3 go
4
5 /* 用途:根据类别号获取根类别的属性类别
6 * 添加:***
7 * 时间:2008/08/14
8 */
9 CREATE PROCEDURE [dbo].[GetCateProCate]
10 @PCID int
11 AS
12 DECLARE
13 @RootID int,
14 @DropdownListStr nvarchar(1000),
15 @RtnStr nvarchar(4000),
16 @CPID_CACHE nvarchar(10),
17 @CPNameCN_CACHE nvarchar(30),
18 @CPVID_CACHE nvarchar(10),
19 @CPVName_CACHE nvarchar(30)
20 BEGIN
21 SET @RootID=(
22 SELECT B.PCID FROM w_cateselect A,w_Productcategorys B
23 WHERE A.w_P_PCID=@PCID AND A.PCID=B.PCID AND B.ParentID=0)
24
25 SET @RtnStr='';
26 SET @DropdownListStr='';
27
28 --外层游标
29 DECLARE CPID_CURSOR CURSOR FOR
30 SELECT CPID,CPNameCN FROM w_CategoryProperty WHERE PCID=@RootID;
31 OPEN CPID_CURSOR;
32 FETCH NEXT FROM CPID_CURSOR INTO @CPID_CACHE,@CPNameCN_CACHE;
33 WHILE @@FETCH_STATUS=0
34 BEGIN
35 --内层游标
36 DECLARE CPVID_CURSOR CURSOR FOR
37 SELECT CPVID,CPVName FROM w_CateProValue WHERE CPID=@CPID_CACHE;
38 OPEN CPVID_CURSOR;
39 FETCH NEXT FROM CPVID_CURSOR INTO @CPVID_CACHE,@CPVName_CACHE;
40
41 IF(@@FETCH_STATUS=0)
42 BEGIN
43 SET @DropdownListStr=@CPNameCN_CACHE+
44 '<select id=''CP_'+CAST(@CPID_CACHE AS nvarchar)+
45 ''' name=''CPDownlist''><option value=''0000''>-请选择-</option>';
46
47 WHILE @@FETCH_STATUS=0
48 BEGIN
49 IF(@CPVID_CACHE!='')
50 BEGIN
51 SET @DropdownListStr=@DropdownListStr+'<option value='''
52 +@CPVID_CACHE+'''>'+@CPVName_CACHE+'</option>';
53 END
54 FETCH NEXT FROM CPVID_CURSOR INTO @CPVID_CACHE,@CPVName_CACHE;
55 END;
56 SET @DropdownListStr=@DropdownListStr+'</select>';
57 SET @RtnStr=@RtnStr+@DropdownListStr;
58 END;
59
60 CLOSE CPVID_CURSOR;
61 DEALLOCATE CPVID_CURSOR;
62
63 --继续外层游标
64 FETCH NEXT FROM CPID_CURSOR INTO @CPID_CACHE,@CPNameCN_CACHE;
65 END
66 CLOSE CPID_CURSOR;
67 DEALLOCATE CPID_CURSOR;
68 SELECT @RtnStr
69 END
70
71
72
73
1 set ANSI_NULLS ON
2 set QUOTED_IDENTIFIER ON
3 go
4
5 /* 用途:根据类别号获取根类别的属性类别
6 * 添加:***
7 * 时间:2008/08/14
8 */
9 CREATE PROCEDURE [dbo].[GetCateProCate]
10 @PCID int
11 AS
12 DECLARE
13 @RootID int,
14 @DropdownListStr nvarchar(1000),
15 @RtnStr nvarchar(4000),
16 @CPID_CACHE nvarchar(10),
17 @CPNameCN_CACHE nvarchar(30),
18 @CPVID_CACHE nvarchar(10),
19 @CPVName_CACHE nvarchar(30)
20 BEGIN
21 SET @RootID=(
22 SELECT B.PCID FROM w_cateselect A,w_Productcategorys B
23 WHERE A.w_P_PCID=@PCID AND A.PCID=B.PCID AND B.ParentID=0)
24
25 SET @RtnStr='';
26 SET @DropdownListStr='';
27
28 --外层游标
29 DECLARE CPID_CURSOR CURSOR FOR
30 SELECT CPID,CPNameCN FROM w_CategoryProperty WHERE PCID=@RootID;
31 OPEN CPID_CURSOR;
32 FETCH NEXT FROM CPID_CURSOR INTO @CPID_CACHE,@CPNameCN_CACHE;
33 WHILE @@FETCH_STATUS=0
34 BEGIN
35 --内层游标
36 DECLARE CPVID_CURSOR CURSOR FOR
37 SELECT CPVID,CPVName FROM w_CateProValue WHERE CPID=@CPID_CACHE;
38 OPEN CPVID_CURSOR;
39 FETCH NEXT FROM CPVID_CURSOR INTO @CPVID_CACHE,@CPVName_CACHE;
40
41 IF(@@FETCH_STATUS=0)
42 BEGIN
43 SET @DropdownListStr=@CPNameCN_CACHE+
44 '<select id=''CP_'+CAST(@CPID_CACHE AS nvarchar)+
45 ''' name=''CPDownlist''><option value=''0000''>-请选择-</option>';
46
47 WHILE @@FETCH_STATUS=0
48 BEGIN
49 IF(@CPVID_CACHE!='')
50 BEGIN
51 SET @DropdownListStr=@DropdownListStr+'<option value='''
52 +@CPVID_CACHE+'''>'+@CPVName_CACHE+'</option>';
53 END
54 FETCH NEXT FROM CPVID_CURSOR INTO @CPVID_CACHE,@CPVName_CACHE;
55 END;
56 SET @DropdownListStr=@DropdownListStr+'</select>';
57 SET @RtnStr=@RtnStr+@DropdownListStr;
58 END;
59
60 CLOSE CPVID_CURSOR;
61 DEALLOCATE CPVID_CURSOR;
62
63 --继续外层游标
64 FETCH NEXT FROM CPID_CURSOR INTO @CPID_CACHE,@CPNameCN_CACHE;
65 END
66 CLOSE CPID_CURSOR;
67 DEALLOCATE CPID_CURSOR;
68 SELECT @RtnStr
69 END
70
71
72
73