Problemas con tiempo de carga de un menu (¿Demasiadas consultas a la BD?) Tengo un gran poblema con este menu, y es que me ralentiza, hasta tal punto la carga, que en internet no funciona, solo me funciona en ordenador, el codigo es este, aparte del menu me crea hojas de estilo personalizadas para cada submenu:
<table width="60" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="5"><img src="../imagenes/fondos/px.gif" width="5" height="5"></td>
<td width="43">
<%
set rs12=Server.CreateObject("ADODB.Recordset")
SQL12="SELECT * FROM PRODUCTOS where SUBID = 0"
rs12.Open SQL12, Conn
'n = 0
while not rs12.EOF
'n = n
'n = n + 1%>
<table width="60" border="0" cellpadding="0" cellspacing="0" id="<%=rs12("ID")%>">
<tr>
<td> <style type="text/css">
<!--
A.<%=rs12.Fields("ID")%>:link {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
text-align: right;
color:#<%=rs12("COLORTEXTO")%>;
text-decoration: none;
vertical-align: baseline;
}
A.<%=rs12.Fields("ID")%>:visited {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
text-align: right;
color:#<%=rs12("COLORTEXTO")%>;
text-decoration: none;
}
A.<%=rs12.Fields("ID")%>:active {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
text-align: right;
color:#<%=rs12("COLORTEXTO")%>;
text-decoration: none;
}
A.<%=rs12.Fields("ID")%>:hover {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
color:#FFFFFF;
text-decoration: none;
vertical-align: baseline;
font-weight: normal;
background-color: #<%=rs12("COLORSOBRE")%>;
}
-->
</style>
<div id="<%=rs12.Fields("NOMBRE")%>" style="position:absolute; width:100px; height:15px; left: 88px; z-index: 3; background-color: #<%=rs12.Fields("COLORCAPA")%>; layer-background-color: #FFFFFF; border: 1px none #000000; visibility: hidden;">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="top">
<%
set rs31=Server.CreateObject("ADODB.Recordset")
SQL31="SELECT * FROM PRODUCTOS where SUBID = " &rs12("ID")
rs31.Open SQL31, Conn
while not rs31.EOF
%>
<table width="100" border="0" cellpadding="0" cellspacing="0" class="cuadro">
<tr>
<td> <table width="100" height="25" border="0" cellpadding="0" cellspacing="0" id="<%=rs31("ID")%>">
<tr>
<td valign="bottom" > <div id="<%=rs31.Fields("NOMBRE")%>" style="position:absolute; width:100px; height:25px; z-index:3; left: 97px; visibility: hidden;">
<%
set rs61=Server.CreateObject("ADODB.Recordset")
SQL61="SELECT * FROM PRODUCTOS where SUBID = " &rs31("ID")
rs61.Open SQL61, Conn
n=1
while not rs61.EOF
n=n +1
%>
<style type="text/css">
<!--
A.<%=rs61.Fields("ID")%>:link {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
text-align: right;
color:#<%=rs61("COLORSOBRE")%>;
text-decoration: none;
vertical-align: baseline;
}
A.<%=rs61.Fields("ID")%>:visited {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
text-align: right;
color:#<%=rs61("COLORSOBRE")%>;
text-decoration: none;
}
A.<%=rs61.Fields("ID")%>:active {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
text-align: right;
color:#<%=rs61("COLORSOBRE")%>;
text-decoration: none;
}
A.<%=rs61.Fields("ID")%>:hover {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
color:#<%=rs61("COLORTEXTO")%>;
text-decoration: none;
font-weight: normal;
background-color: #<%=rs61("COLORCAPA")%>;
}
-->
</style>
<table width="100" height="25" border="0" cellpadding="0" cellspacing="0" bgcolor="<%=rs12.Fields("COLORABAJO")%>" class="cuadro" id="<%=rs61("ID")%>">
<tr>
<td width="100" valign="middle" ><a href="productos2.asp?ID=<%=rs61("ID")%>&Categ=<%=r s61("SUBID")%>&N=1&CategID=<%=rs61("CATEGORIA")%>" onmouseover="cambiaFondo('<%=rs61("ID")%>','<%=rs6 1("COLORCAPA")%>');MM_showHideLayers('<%=rs61.Fiel ds("NOMBRE")%>1','','show')" onmouseout="cambiaFondo('<%=rs61("ID")%>','<%=rs12 .Fields("COLORABAJO")%>')" class="<%=rs61.Fields("ID")%>"> <%=rs61("NOMB RE")%></a> <div id="<%=rs61.Fields("NOMBRE")%>1" style="position:absolute; width:175px; height:25; z-index:4; left: 100px; visibility: hidden;">
<%
set rs71=Server.CreateObject("ADODB.Recordset")
SQL71="SELECT * FROM PRODUCTOS where SUBID = " &rs61("ID")
rs71.Open SQL71, Conn
n=1
while not rs71.EOF
n=n +1
%>
<table width="175" height="25" border="0" cellpadding="0" cellspacing="0" bgcolor="<%=rs12.Fields("COLORABAJO")%>" class="cuadro" id="<%=rs71("ID")%>">
<tr>
<td width="175" valign="middle" ><a href="productos2.asp?ID=<%=rs71("ID")%>&Categ=<%=r s71("SUBID")%>&N=1&CategID=<%=rs71("CATEGORIA")%>" onmouseover="cambiaFondo('<%=rs71("ID")%>','<%=rs7 1("COLORCAPA")%>')" onmouseout="cambiaFondo('<%=rs71("ID")%>','<%=rs12 .Fields("COLORABAJO")%>')" class="<%=rs61.Fields("ID")%>"> <%=rs71("NOMB RE")%></a>
</td>
</tr>
</table>
<%
rs71.MoveNext
wend
%>
</div></td>
</tr>
<tr>
<td height="4" valign="middle"><img src="../imagenes/fondos/px.gif" width="100%" height="4" onMouseOver="
<%
set rs111=Server.CreateObject("ADODB.Recordset")
SQL111="SELECT * FROM PRODUCTOS where SUBID = " &rs31("ID")
rs111.Open SQL111, Conn
while not rs111.EOF %>
ocultaCapa('<%=rs111.Fields("NOMBRE")%>1');
<%rs111.MoveNext
wend%>"></td>
</tr>
</table>
<%
rs61.MoveNext
wend
%>
</div>
<!--'productos3.asp?ID=<%'=rs12("ID")%>&N=1&Categ=<%'= rs31("NOMBRE")%>&CategID=<%'=rs12("ID")%>" class="<%'=replace(rs12.Fields("NOMBRE")," ","_")%>-->
<a href="javascript:;" onMouseOver="MM_showHideLayers('<%=rs31.Fields("NO MBRE")%>','','show');cambiaFondo('<%=rs31("ID")%>' ,'<%=rs12("COLORSOBRE")%>')" onmouseout="cambiaFondo('<%=rs31("ID")%>','<%=rs12 .Fields("COLORCAPA")%>')" class="<%=rs12.Fields("ID")%>"> <%=rs31.Field s("NOMBRE")%></a>
</td>
</tr>
<tr>
<td height="4"><img src="../imagenes/fondos/px.gif" width="100%" height="4" onMouseOver="
<%
set rs11=Server.CreateObject("ADODB.Recordset")
SQL11="SELECT * FROM PRODUCTOS where SUBID = " &rs12("ID")
rs11.Open SQL11, Conn
while not rs11.EOF %>
ocultaCapa('<%=rs11.Fields("NOMBRE")%>');
<%rs11.MoveNext
wend%>"></td>
</tr>
</table></td>
</tr>
</table>
<a href="javascript:;" class="menuarriba"></a><a href="javascript:;" onMouseOver="MM_showHideLayers('<%=rs31.Fields("NO MBRE")%>','','show')"></a>
<%
rs31.MoveNext
wend
%>
</td>
</tr>
</table>
</div>
<%
response.write "<a href='productos2.asp?ID="&rs12("ID")&"&N=1&Categ=" &rs12("NOMBRE")&"&CategID="&rs12("ID")&"' class=menucolor2 onmouseover=""cambiaFondo('"&rs12("ID")&"','#CDE3E 6')"" onmouseout=""cambiaFondo('"&rs12("ID")&"','')""><d iv align=right onMouseOver=""MM_showHideLayers('"&rs12.Fields("NO MBRE")&"','','show')"">"&rs12.Fields("NOMBRE")& "</div></a>"
%>
</td>
</tr>
<tr>
<td><img src="../imagenes/fondos/px.gif" width="100%" height="10" onMouseOver="
<%
set rs5=Server.CreateObject("ADODB.Recordset")
SQL5="SELECT * FROM PRODUCTOS where SUBID = 0"
rs5.Open SQL5, Conn
while not rs5.EOF %>
ocultaCapa('<%=rs5.Fields("NOMBRE")%>');
<%rs5.MoveNext
wend%>"></td>
</tr>
</table>
<%
rs12.MoveNext
wend%>
</td>
</tr>
</table>
<%'cerramos los elementos
rs12.Close
set rs12=nothing
rs31.Close
set rs31=nothing
rs61.Close
set rs61=nothing
rs11.Close
set rs11=nothing
rs5.Close
set rs5=nothing
%>
Haber si alguien me puede ayudar para que esto se cargue mas rapidamente. O me puede decir de que otra forma podria hacer estas consultas a la base de datos para que me saque este menu.
Un saludo
__________________ asp, php, .net, adaptandose a las necesidades |