puesto que me ordene por ciertas columnas pero me marca error de que se
Se requiere un objeto: 'rs2', pero no se que pueda estar mal
Código:
<!-- #include file="../conexion.asp"--> <% call conectarDB Dim sSQL, rs, ordenar ordenar = request.querystring("ordenar") distribuidor = request.QueryString("distribuidor") if ordenar <>0 then Select Case ordenar Case 1 ordenar_por = "peticiones_id" Case 2 ordenar_por = "peticiones_encabezado" Case 3 ordenar_por = "peticiones_pantallas_funciones" Case 4 ordenar_por = "peticiones_fecha_registro" Case else ordenar_por = "peticiones_id" End select sSQL = "Select * from DS_peticiones where peticiones_numero_distribuidores ='"& distribuidor &"' AND peticiones_estatus <> 'AC' ORDER BY "& ordenar_por Set rs = cnn.Execute(sSQL) else sSQL = "Select * FROM DS_peticiones where peticiones_numero_distribuidores ='"& distribuidor &"' AND peticiones_estatus <> 'AC' ORDER BY peticiones_id" Set rs = cnn.execute(sSQL) end if %> <body> <div class="central"> <table border="0" width="100%" cellpadding="0" cellspacing="0"> <tr> <td class="abajo"><strong><a href="consultaPeticiones.asp?ordenar=1"># ID</a></strong></td> <td class="abajo"><strong><a href="consultaPeticiones.asp?ordenar=2">PETICIÓN</a></strong></td><td class="abajo" width="40"> </td> <td width="330" class="abajo"><strong><a href="consultaPeticiones.asp?ordenar=3">PANTALLA</a></strong></td> <td width="134" class="abajo"><strong><a href="consultaPeticiones.asp?ordenar=4">FECHA REGISTRO</a></strong></td> </tr> <tr><td> </td></tr> <% Dim cadena cadena = "" do while not rs.eof sqluno = "Select usuarios_id, usuarios_nombre from DS_Usuarios where usuarios_id = '"& rs("peticiones_numero_distribuidores") &"'" Set rs1 = cnn.execute(sqluno) if not rs1.eof then NombreDist = rs1("usuarios_nombre") end if sqldos = "Select clientes_id, clientes_nombre_comercial from DS_ClientesDatosGenerales where clientes_id = '"& rs("peticiones_numero_cliente") &"'" Set rs2 = cnn.execute(sqldos) if not rs2.eof then NomCliente = rs2("clientes_nombre_comercial") end if cadena = rs("peticiones_id") &"|"& NomCliente &"|"& rs("peticiones_pantallas_funciones") &"|"& rs("peticiones_encabezado") cadena = cadena &"|"& rs("peticiones_comentario") %> <tr> <td width="39" class="alinear"><% = rs("peticiones_id")%></td> <td width="468" class="alinear"><a href="" onclick="recuperaDato(this.id)" id="<% = cadena%>"> <% = rs("peticiones_encabezado")%></a></td><td class="alinear"> </td> <td class="alinear"><% = rs("peticiones_pantallas_funciones")%></td> <td class="alinear"><% = rs("peticiones_fecha_registro")%></td> </tr> <% rs.movenext loop rs.close Set rs = nothing rs1.close Set rs1 = nothing rs2.close Set rs2 = nothing %> </table> <br /><br /><br /><br /> <table width="100%"><tr><td align="right"><input name="imprimir" type="image" id="imprimir" value="imprimir" onclick="imprime=window.print();" src="images/IMPRIMIR_LISTADO1.gif" /></td></tr></table> </div> </body> </html> <% call desconectarDB %>