Ver Mensaje Individual
  #2 (permalink)  
Antiguo 10/10/2005, 19:34
Avatar de u_goldman
u_goldman
Moderador
 
Fecha de Ingreso: enero-2002
Mensajes: 8.031
Antigüedad: 23 años, 4 meses
Puntos: 98
No entiendo muy bien lo que dices, pero para mi mas o menos quieres saber que productos ha comprado cierto cliente?

Hazte un metodo, en mi caso le llamare GetProducts dentro de tu clase cliente, que le llamare client y que me regresara un array con todos los campos de productos que ha comprado este cliente, despues puedo iterar este array

Código:
<%
Class client
  Private m_client_id

  Public Property Get client_id()
    client_id = m_client_id
  End Property
  Public Property Let client_id(p_data)
    m_client_id = p_data
  End Property


  Public Function GetProducts()
    Dim rs
    Dim param
    Dim cmd
    Dim ObjConn
    Dim qry
    Set ObjConn= Server.CreateObject("ADODB.Connection")
    Set rs = Server.CreateObject("ADODB.Recordset")
    Set cmd = Server.CreateObject("ADODB.Command")
    qry = "SELECT todos_los_campos_que_quiero_de_productos FROM x_cantidad_de_tablas WHERE tabla.campo_cliente_id = ?"
    Set param = cmd.CreateParameter("client_id", adInteger, adParamInput, 4, m_client_id)
    ObjConn.Open stringDeConexion
    cmd.Parameters.Append(param)
    cmd.ActiveConnection = ObjConn
    cmd.CommandType = adCmdText
    cmd.Commandtext = qry
    rs.CursorType = 3
    rs.Open cmd
    if not rs.EOF then
       ds = rs.GetRows()
       rs.Close
    else
       ds = Null
    end if
    Set rs = Nothing
    Set param = Nothing
    Set cmd = Nothing
    ObjConn.Close
    Set ObjConn = Nothing
    GetProducts = ds
  End Function
End Class
%>


<%
Set ObjClient = new client
ObjClient.client_id = 4
ds = ObjClient.GetProducts()

if isArray(ds) then
  'itero
  for j =0 to uBound(ds,2)
    Response.write(ds(0,j) & "," & ds(1,j)' & etc...)
  next
else
  'No hay productos
end if
%>
Cualquier cosa por aca andamos.

Salu2,
__________________
"El hombre que ha empezado a vivir seriamente por dentro, empieza a vivir más sencillamente por fuera."
-- Ernest Hemingway