Existing 10W data, Access database save
Through normal extraction:
Copy Code code as follows:
<%
Set conn= Server.CreateObject ("ADODB.") Connection ")
C&server.mappath ("Db2.mdb")
Conn. Open ConnStr
Set rs = Server.CreateObject ("ADODB.") Recordset ")
sql = "SELECT * from people ORDER by id DESC"
Rs. Open sql,conn,1,1
Do but not Rs. Eof
Response.Write RS ("id") & | "
Rs. MoveNext
Loop
%>
Http://www.cnbruce.com/test/getrows/show1.asp
Takes 3,250.000 milliseconds with a total test average of about 3 seconds
==========================================================
Using Stored procedure extraction:
Copy Code code as follows:
<%
Set conn = Server.CreateObject ("ADODB. Connection ")
Set cmd = Server.CreateObject ("Adodb.command")
Conn. Open "Provider=Microsoft.Jet.OLEDB.4.0; Data source= "& Server.MapPath (" Db2.mdb ")
Cmd. ActiveConnection = conn
Cmd.commandtext = "SELECT * from people ORDER by id DESC"
Set rs = cmd. Execute
Do but not Rs. Eof
Response.Write RS ("id") & | "
Rs. MoveNext
Loop
%>
Http://www.cnbruce.com/test/getrows/show2.asp
Takes 2,187.500 milliseconds with a total test average of about 2 seconds
=========================================================
Neither of these can solve the problem of long execution time, the main reason is that the loop must be extracted to the database every time (command speed is relatively fast)
Then use the GetRows () method:
Copy Code code as follows:
<%
Set conn = Server.CreateObject ("ADODB. Connection ")
Set cmd = Server.CreateObject ("Adodb.command")
Conn. Open "Provider=Microsoft.Jet.OLEDB.4.0; Data source= "& Server.MapPath (" Db2.mdb ")
Cmd. ActiveConnection = conn
Cmd.commandtext = "SELECT * from people ORDER by id DESC"
Set rs = cmd. Execute
Rsarray = Rs. GetRows ()
For i = 0 to UBound (Rsarray, 2)
Response.Write Rsarray (0, i) & "| "
Next
%>
Http://www.cnbruce.com/test/getrows/show3.asp
Takes 187.500 milliseconds, the total test average is about 0.2 seconds
The GetRows () method copies the data from the Recordset into a two-dimensional array, which is a two-dimensional array, the first subscript identifies the field, and the second identifies the record number
So Rsarray = Rs. GetRows ()
Rsarray (0, 0) represents the first field value in the first row of the recordset
Rsarray (1, 0) represents the value of the second field in the first row of a recordset
The data for the array is stored in memory, which fundamentally solves the problem of requesting the database each time the record is displayed.