Many IT friends know that there is a GetRows attribute, so how do we use the GetRows function? Interested friends, let’s learn about it with the editor!
In fact, this property is very simple, it is to output the data set into an array. But it is quite practical. Here I will give you an example to illustrate how to use GetRows. You can think of more usage by learning from it!
For example, a classification table T_Cate, the structure and data are as follows:
ID|Title|Intro
--------------------------------------------------------------------------------------------------------------------------------
1|News|This is news
2|Tutorial|Here is the tutorial
3|Download|Here is download
Okay, the table is established and the data is available. Now we will use GetRows!
The code copy is as follows:
DimRs_Cate
DimArr_Cate
SetRs_Cate=Conn.ExeCute("SELECTID,Title,IntroFROMT_CateORDERBYIDASC")
Arr_Cate=Rs_Cate.GetRows
SetRs_Cate=Nothing
OK, the table data has been exported to the array! Next we will iterate through this array
The code copy is as follows:
DimArr_CateNumS,Arr_CateNumI
Arr_CateNumS=Ubound(Arr_Cate,2)'Get subscript of data in the array
ForArr_CateNumI=0ToArr_CateNumS
Response.Write("ID:"&Arr_Cate(0,Arr_CateNumI)&"|Title: "&Arr_Cate(1,Arr_CateNumI)&"|Introduction: "&Arr_Cate(2,Arr_CateNumI)&"
")
Next
OK, the output data is:
ID: 1 | Title: News | Introduction: Here is the news
ID: 2 | Title: Tutorial | Introduction: Here is the tutorial
ID: 3 | Title: Download | Introduction: Here is the download
Okay, let’s write so much in detail! Please continue to pay attention to the Wuxin Technology Channel for more related content.