Ver Mensaje Individual
  #2 (permalink)  
Antiguo 02/05/2012, 08:44
Avatar de freesoftwarrior
freesoftwarrior
 
Fecha de Ingreso: marzo-2006
Mensajes: 362
Antigüedad: 18 años, 1 mes
Puntos: 10
Respuesta: Montar tablas de datos complejas

GetRows(). Te explico con un ejemplo

Cita:
<%
Temp="Select * From Clientes"
Tabla.Open Temp, Conexion
arrDBDataClientes=Tabla.GetRows()
Tabla.Close

Temp="Select * From Ventas"
Tabla.Open Temp, Conexion
arrDBDataVentas=Tabla.GetRows()
Tabla.Close

Temp="Select * From Stock"
Tabla.Open Temp, Conexion
arrDBDataStock=Tabla.GetRows()
Tabla.Close
%>

<table>
<tr>
<td>Cliente</td>
<td>Monto Venta</td>
<td>Producto</td>
...etc
</tr>

<%
For J = 0 To UBound(arrDBDClientes, 2)

'buscando que compras realizó el cliente
For K = 0 To UBound(arrDBDataVentas, 2)
If arrDBDataClientes(1,J) = arrDBDataVentas(2,K) Then 'estoy comparando ID o RUC

'buscando el nombre del producto vendido
For M = 0 To UBound(arrDBDStock, 2)
If arrDBDataStock(0,M) = arrDBDataVentas(8,K) Then
%>

<tr>
<td><%= arrDBDataClientes(5,J) %></td> <!-- nombre del cliente -->
<td><%= arrDBDataVentas(9,K) %></td> <!-- monto de la venta -->
<td><%= arrDBDataStock(3,M) %></td> <!-- nombre del producto -->
...etc
</tr>

<%
End If
Next
End If

Next

Next
%>
</table>
Bueno, esa es la idea, lo he hecho a la volada, pero de que funciona, funciona.
Espero haberte ayudado.

Un saludo desde el Perú