Data
Data stereotypes are the process of defining a set of stereotypes, a qualitative recordset that we can consider to be a hierarchical Recordset, divided into three different levels:
Relational level, parametric level, grouping level.
I think the biggest advantage of this technology is: No data redundancy, the interface is clear and simple, for multi-layer data operation is more convenient
To apply this technique, you need to set the provider in the data-driven connection string to: MSDataShape
Specific application requires shape command: And there are two different shape statements:
One, SHAPE{SQL1} append ({sql2} as, relate A to B)
The way he works is to query the SQL1 first, then query SQL2 based on the criteria relate A to B, and then add a field after SQL1 retrieve the result, which is used to hold the corresponding recordset for the SQL2 query result, that is, the SQL1 query result is the parent recordset. The SQL2 query result is a child Recordset.
There are two types of this approach: relationship hierarchy and parametric hierarchy
Relational Hierarchy Example: Shape{select a,b from T1} append ({Select m,n from t2} relate a=m)
Example of a parameterized hierarchy: Shape{select a,b from T1} append ({Select m,n from T2 where m=?} relate A to Parameter 0)
Visible, in the parametric hierarchy, there is a where m=? and a parameter 0
This function starts with the previous relational level, but the working principle is different, in this case, the data is not planted at once, retrieves only the data on the parent Recordset, and the child Recordset is retrieved only when you display a recordset that is based on the chapter field.
Example:
<%
Set Db = Server.CreateObject ("ADODB.") Connection ")
Set rs = Server.CreateObject ("ADODB.") Recordset ")
mmm= "Driver={sql server};server=192.1.1.21;uid=sa;pwd=myself;database=gwjp2"
Db. Provider= "MSDataShape"
Db. Open mmm
Rs. Open "Shape{select name,id from TGW} append ({Select Name,gwid from tren} as Liu Relate ID to gwid) as Liu", db,3,1
Response.Write Rs. RecordCount
Response.Write "Do but not Rs. Eof
Response.Write "Post name:" & RS (0)
Set Qq=rs ("Liu"). Value
Response.Write "<br> record number" & Qq.recordcount & ":<br>"
Do as not qq.eof
For I=0 to Qq.fields.count-1
Response.Write QQ (i) & "|"
Next
Response.Write "<br>"
Qq.movenext
Loop
Response.Write "<br>"
Response.Write "Rs. MoveNext
Loop
%>
The results of the execution are:
42
--------------------------------------------------------------------------------
Post name: Network system Management B
Number of records 0:
--------------------------------------------------------------------------------
Job Title: Application Software Development J
Number of records 2:
Wang Linsong | 9 |
Yang Long | 9 |
--------------------------------------------------------------------------------
Job Title: Stock Market Analysis
Number of records 0:
--------------------------------------------------------------------------------
Job Title: Copy worker
Number of records 4:
Wu Rongping | 68 |
Li Lijie | 68 |
Liu Xiuzhi | 68 |
Lu Haihui | 68 |
--------------------------------------------------------------------------------
Post Name: Toushou member B
Number of records 1:
Plum | 69 |
--------------------------------------------------------------------------------
Post name: After-sales service station Director H
Number of records 1:
Guan Yuming | 111 |
--------------------------------------------------------------------------------
Post name: On-site Technical Diagnosis D
Number of records 1:
Shi | 121 |
--------------------------------------------------------------------------------
Job Title: On-site technical Diagnosis G
Number of records 3:
Zhang Hongjun | 123 |
Dong Zheng | 123 |
Gongping | 123 |
--------------------------------------------------------------------------------
Job Title: Law enforcement Monitoring B
Number of records 0:
--------------------------------------------------------------------------------
Job Title: Cleaning
Number of records 3:
Zhang Xiuying | 152 |
Sun Yanmei | 152 |
Zhang Jinghua | 152 |
--------------------------------------------------------------------------------
Post Name: Quality system
Number of records 1:
Liu Yanyu | 160 |
--------------------------------------------------------------------------------
Post name: External co-Test B
Number of records 2:
He Guowei | 206 |
Horse Independence | 206 |
--------------------------------------------------------------------------------
Job Title: Electrical and mechanical Parts inspection C
Number of records 2:
Chianguo | 207 |
Wang Chunxia | 207 |
--------------------------------------------------------------------------------
Post Name: Research Secretary D
Number of records 1:
Shi Jimin | 216 |
--------------------------------------------------------------------------------
Job Title: Policy Research B
Number of records 0:
--------------------------------------------------------------------------------
Post name: typing copy C
Number of records 1:
Liu Chilo | 280 |
--------------------------------------------------------------------------------
Job Title: Warehouse Management
Number of records 4:
Jiang Li | 485 |
Sanli Mei | 485 |
Xu Li | 485 |
Hu Lanfeng | 485 |
--------------------------------------------------------------------------------
Job Title: Financial Analysis
Number of records 0:
--------------------------------------------------------------------------------
Job Title: Greening Technology Management A
Number of records 1:
Ningjia | 560 |
--------------------------------------------------------------------------------
Job Title: Greening Technology Management B
Number of records 3:
Cao Fungming | 592 |
Liu Wanchun | 592 |
Wang an | 592 |
--------------------------------------------------------------------------------
Post name: Total value Shift Schedule D
Number of records 3:
Liu Welfare | 627 |
Zhou Zhimin | 627 |
Zhang Tongshun | 627 |
--------------------------------------------------------------------------------
Job Title: Production Schedule L
Number of records 2:
Quanliping | 628 |
Wu Minggui | 628 |
--------------------------------------------------------------------------------
Job Title: Environmental Testing Laboratory A
Number of records 1:
Hou Zhiwei | 651 |
--------------------------------------------------------------------------------
Job Name: Environmental testing Test B
Number of records 2:
Han Xichun | 652 |
Han Yumei | 652 |
--------------------------------------------------------------------------------
Job Title: Asset Management A
Number of records 2:
Shi | 665 |
Wang Wei | 665 |
--------------------------------------------------------------------------------
Job Title: Energy Outsourcing and outreach
Number of records 1:
Ma Dawei | 667 |
--------------------------------------------------------------------------------
Post name: Energy monitoring and arbitration
Number of records 5:
Ziqi of the study of righteousness | 682 |
Sun Qingyun | 682 |
Liu Guard | 682 |
Zhang Qine | 682 |
Wang Yingli | 682 |
--------------------------------------------------------------------------------
Post name: East Gate guard F-i
Number of records 7:
Xu Chaojun | 747 |
Shiyong | 747 |
Wang Hongwei | 747 |
Bai | 747 |
Wu Yong | 747 |
Gould Rich | 747 |
Yang Quan | 747 |
--------------------------------------------------------------------------------
Post name: South Gate guard G-i
Number of records 5:
Wang Zhihui | 749 |
Zhang Qing | 749 |
Dong | 749 |
Huang Jidong | 749 |
Bamboo Learning Front | 749 |
--------------------------------------------------------------------------------
Post name: Material door Guard I
Number of records 1:
Wan Peng Sword | 751 |
--------------------------------------------------------------------------------
Post name: Simon Guard H,i
Number of records 2:
Zhang Guiping | 753 |
He Wenli | 753 |
--------------------------------------------------------------------------------
Post name: Change car point guard B
Number of records 1:
Ji Yan | 757 |
--------------------------------------------------------------------------------
Post name: South Gate Guards
Number of records 3:
Shen | 759 |
Jing Fai | 759 |
Han Li | 759 |
--------------------------------------------------------------------------------
Post name: Dedicated door guard b-d
Number of records 7:
Gao Bin | 761 |
Yangguo Bridge | 761 |
Han Wensheng | 761 |
Miao Wenquan | 761 |
gaoming | 761 |
Zhao Rui | 761 |
Xu Benchun | 761 |
--------------------------------------------------------------------------------
Post name: Logistics Service B
Number of records 3:
Wang Xiupo | 763 |
Xu Yue | 763 |
Jiangli | 763 |
--------------------------------------------------------------------------------
Job Title: Operating budget plan
Number of records 0:
--------------------------------------------------------------------------------
Job Title: Asset Management
Number of records 1:
Yu Guochun | 805 |
--------------------------------------------------------------------------------
Position Name: metallographic Examination and analysis
Number of records 2:
Li Chunsheng | 806 |
Yang Ying | 806 |
--------------------------------------------------------------------------------
Post Name: Toushou Member
Number of records 1:
Wu Xiaohua | 807 |
--------------------------------------------------------------------------------
Position Name: Tube Storehouse
Number of records 3:
Shiyume | 808 |
Baiju New | 808 |
Xuan Yuan Yunlong | 808 |
--------------------------------------------------------------------------------
Job Title: Beijing Project Department business organizer A
Number of records 2:
Liu Yahua | 809 |
Guan Xiyuan | 809 |
--------------------------------------------------------------------------------
Post name: Blueprint worker C-j
Number of records 3:
Zhao Yuzhu | 810 |
Chaoli | 810 |
Chongjon | 810 |
Two, SHAPE{SQL1} as A1 compute A1 by Groupfieldlist
The way he works is to group SQL1 query results according to Groupfieldlist, each set up a single word recordset. The first field in the parent Recordset holds a pointer to the corresponding child Recordset, and the other fields of the parent Recordset store the corresponding groupfieldlist values.
Examples are as follows:
<%
Set Db = Server.CreateObject ("ADODB.") Connection ")
Set rs = Server.CreateObject ("ADODB.") Recordset ")
mmm= "Driver={sql server};server=192.1.1.21;uid=sa;pwd=myself;database=gwjp2"
Db. Provider= "MSDataShape"
Db. Open mmm
Rs. Open "Shape{select dwname, Gwlevel from Tzl to Dwname as DDD compute DDD by Dwname,gwlevel", db,3,1
Response.Write Rs. RecordCount
Response.Write "Do but not Rs. Eof
Tt= ""
For I=1 to Rs. Fields.count-1
tt= tt & "" & RS (i)
Next
Set Qq=rs (0). Value
Response.Write "<font color=ff0000>" & TT & "---------" & Qq.recordcount & "<br></fon T> "
Do as not qq.eof
For I=0 to Qq.fields.count-1
Response.Write QQ (i) & "= ="
Next
Response.Write "<br>"
Qq.movenext
Loop
Response.Write "Rs. MoveNext
Loop
%>
The results of the execution are:
24
--------------------------------------------------------------------------------
XX Company Manufacturing Department---------2
XX Company Manufacturing Department ====13====
XX Company Manufacturing Department ====13====
--------------------------------------------------------------------------------
XX Company Manufacturing Department---------2
XX Company Manufacturing Department ====35====
XX Company Manufacturing Department ====35====
--------------------------------------------------------------------------------
XX Company Manufacturing Department---------2
XX Company Manufacturing Department ====39====
XX Company Manufacturing Department ====39====
--------------------------------------------------------------------------------
XX Company Market 9---------1
A ====9==== of XX company Market
--------------------------------------------------------------------------------
XX company Market a---------1
A ====14==== of XX company Market
--------------------------------------------------------------------------------
XX company Market One---------1
A ====37==== of XX company Market
--------------------------------------------------------------------------------
XX company Market One---------1
A ====40==== of XX company Market
--------------------------------------------------------------------------------
XX company Market a---------1
A ====45==== of XX company Market
--------------------------------------------------------------------------------
XX Company Assets Operation Department 9---------1
XX Company Asset Operation Department ====9====
--------------------------------------------------------------------------------
XX company Assets Operation Department---------2
XX Company Asset Operation Department ====39====
XX Company Asset Operation Department ====39====
--------------------------------------------------------------------------------
XX company Assets Operation Department---------1
XX Company Asset Operation Department ====41====
--------------------------------------------------------------------------------
XX Company Comprehensive Safeguard Department 9---------1
XX Company Comprehensive safeguard Department ====9====
--------------------------------------------------------------------------------
XX Company Comprehensive safeguard Department---------4
XX Company Comprehensive safeguard Department ====14====
XX Company Comprehensive safeguard Department ====14====
XX Company Comprehensive safeguard Department ====14====
XX Company Comprehensive safeguard Department ====14====
--------------------------------------------------------------------------------
XX Company Comprehensive Protection Department---------1
XX Company Comprehensive safeguard Department ====15====
--------------------------------------------------------------------------------
XX Company Comprehensive safeguard Department---------6
XX Company Comprehensive safeguard Department ====17====
XX Company Comprehensive safeguard Department ====17====
XX Company Comprehensive safeguard Department ====17====
XX Company Comprehensive safeguard Department ====17====
XX Company Comprehensive safeguard Department ====17====
XX Company Comprehensive safeguard Department ====17====
--------------------------------------------------------------------------------
XX Company Comprehensive Protection Department---------3
XX Company Comprehensive safeguard Department ====18====
XX Company Comprehensive safeguard Department ====18====
XX Company Comprehensive safeguard Department ====18====
--------------------------------------------------------------------------------
Quality Assurance Department Measurement Office---------1
Quality Assurance Department Measurement Department ====15====
--------------------------------------------------------------------------------
Quality Assurance Department Quality Management Department---------2
Quality Assurance Department Quality Management Department ====26====
Quality Assurance Department Quality Management Department ====26====
--------------------------------------------------------------------------------
Quality Assurance Department Quality Management Department---------1
Quality Assurance Department Quality Management Department ====41====
--------------------------------------------------------------------------------
Business Administration Department Information Center 1---------
Enterprise Management Department Information Center ====41====
--------------------------------------------------------------------------------
Development center of the city Rail train 9---------1
Development center of the city Rail coach ====9====
--------------------------------------------------------------------------------
Research and Development Center Archives 9---------1
Research and Development Center Archives ====9====
--------------------------------------------------------------------------------
Research and Development Center Archives---------1
Research and Development Center Archives ====16====
--------------------------------------------------------------------------------
Research and Development Center Archives---------1
Research and Development Center Archives ====18====
Summary: The above example is very superficial, mainly used for getting started, in fact these levels can be very complex, we generally do not use so complex. If you need to, you can look up some information, but I try to write complex levels, but without success, I encountered some problems that I had not seen before and couldn't solve.