Ver Mensaje Individual
  #19  
Antiguo 19-01-2015
Catublipas Catublipas is offline
Miembro
NULL
 
Registrado: ene 2015
Posts: 55
Reputación: 10
Catublipas Va por buen camino
Las bases de datos no están relacionadas de ahí mi problema,
te expongo lo que he intentado hacer con tu ayuda a ver si así ves mejor el problema:

Código Delphi [-]
procedure TPrueba1Form.Button1Click(Sender: TObject);
begin
  IBQuery1.Close;
  IBQuery1.Open;
  IBQuery2.Close;
  IBQuery2.Open;
  ClientDataSet1.Open;
  while not IBQuery1.eof do
  begin
    ClientDataSet1.Append;
    ClientDataSet1.FieldByName('PROYECTO').Value:= IBQuery1.FieldByName('PROYECTO').Value;
    ClientDataSet1.post;
    while not IBQuery2.eof do
    begin
      ClientDataSet1.Append;
      if IBQuery1.FieldByName('PROYECTO').Value = IBQuery2.FieldByName('PROYECTO').Value then
      begin
        ClientDataSet1.FieldByName('FACTURA').Value:= IBQuery2.FieldByName('NUMEROFAC').Value;
        ClientDataSet1.post;
      end;
      IBQuery2.next;
    end;
    IBQuery1.next;
  end;
end;

Previamente cree en el ClientDataSet los Fields PROYECTO y FACTURA.
De esta manera me lista los proyectos perfectamente pero las facturas me salen vacías, de esta forma:

PROYECTO FACTURA
001
002
003
004


Es un avance pero se me escapa algo. No se si esta información te sirve de algo.

BBDD1

Tabla PROYECTMANAGER

CODIGOPM-->6
PROYECTOS -->1,2,3
NOMBRE--> Carlos

BBDD2

Tabla FACTURAS

PROYECTO-->1
NUMEROFAC-->001,002,003
IMPORTE -->100€,200€,300€

PROYECTO-->2
NUMEROFAC-->004,005,006
IMPORTE -->1500€,2500€,3500€

PROYECTO-->3
NUMEROFAC-->007,008,009
IMPORTE -->50000€,60000€,30000€

Última edición por Catublipas fecha: 19-01-2015 a las 14:15:31.
Responder Con Cita