There was an original project developed using ASP and using Oracle database. Use the code below to get the query statement.
Set RS = Server.CreateObject("ADODB.Recordset")
The SQL statement to be executed by RS.open has a two-level structure in the database connection logic. When looping through the parent data, the child data set contained in each parent data is queried.
strSQL = "SQL statement to query parent data"
RS.open SQL statement to be executed, database connection
Do Until RS.EOF
strSQL2 = "SQL statement to query child data"
RS2.open SQL statement to be executed, database connection
RS2.CLose
RS.MoveNext
Loop
RS.Close
But after switching from the Oracle database to the SQL Server database, the logic has not changed but the time has changed a lot. From the original few seconds to more than 50 seconds, it seems that it is caused by the nested loop of two RecordSets. The solution is to use an array to store the parent data, then execute RS.Close, and then loop through the array to query the child data.
I don't know the reason very well, so please give me some advice. Thanks.
http://blog.csdn.net/dutguoyi/archive/2007/03/18/1532924.aspx