speeding up web page load (2) [closed]
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this questionI've asked a similar question before in which I received responses to fix my multidimensional array to receive records faster with getrows. There are over 36 000 records returned into this multidimensional array. Although previous answers of my other question did not seem to speed up my page my much开发者_Go百科.
I am then using this multidimensional array to check if certain id's match then attach permissions to content.
So my multidimensional array -
'MultiDimensional Array
Dim permissionsArray
Dim permissionsCount
connectionstring = obj_ADO.getconnectionstring
Set c = Server.CreateObject("ADODB.Connection")
Set r = Server.CreateObject("ADODB.Recordset")
r.CursorLocation = 2 'adUseServer
c.open connectionstring
c.CursorLocation = 2 'adUseServer
SQL = "select OP_ObjectID, P_Name from l_objectpermission inner join A_Permission on op_permissionID = P_permissionID order by P_Name"
Set r = Server.CreateObject("ADODB.Recordset")
r.CursorLocation = 2 'adUseServer
r.Open SQL, c, 0, 1 'adOpenForwardOnly, adLockReadOnly
If r.BOF or r.EOF Then
r.close()
Set r = Nothing
Else
permissionsArray = r.GetRows()
permissionsCount = UBound(permissionsArray, 2)
r.Close()
Set r = Nothing
End If
c.Close()
Set c = Nothing
Then content and id's + using multidimensional array to attach permissions
while obj_ADO.EOF(lng_RecSet) = 0
%>
<tr>
<%
objID = obj_ADO.GetField("O_ObjectID", adValue, lng_RecSet)
%>
<td align="center" valign="top"><input type="checkbox" name="selectedRecord" value="<%=objID%>"></td>
<td valign="top" align="left"><font class="Content1"><%=obj_ADO.GetField("O_Name", adValue, lng_RecSet)%></font></td>
<td valign="middle" align="center"><center><div style="text-align: left; width: 180px;">
<%
for i = 0 to (permissionsCount)
if permissionsArray(0, i) = objID then
%>
<li style="height: 2px;">
<%=permissionsArray(1,i)%>
</li>
</br>
<%
end if
next
%>
</div></center></td>
</tr>
<%
obj_ADO.MoveNext(lng_RecSet)
wend
obj_ADO.CloseRecordset lng_RecSet
%>
Fixed this by changing what was loaded into the multidimensional array. Instead of loading everything I loaded by whatever the user filters by
if str_Prefix = "" then
SQL = "select OP_ObjectID, P_Name from l_objectpermission inner join A_Permission on op_permissionID = P_permissionID order by P_Name"
elseif str_Prefix <> "" then
SQL = "select OP_ObjectID, P_Name from l_objectpermission inner join A_Permission on op_permissionID = P_permissionID where P_Name like '" & str_Prefix & "' + '%' OR P_Name like '% ' + '" & str_Prefix & "' + '%' order by P_Name"
else
SQL = "select OP_ObjectID, P_Name from l_objectpermission inner join A_Permission on op_permissionID = P_permissionID order by P_Name"
end if
精彩评论