Ver Mensaje Individual
  #1  
Antiguo 10-04-2017
Avatar de Draker
Draker Draker is offline
Miembro
 
Registrado: ene 2005
Posts: 27
Reputación: 0
Draker Va por buen camino
Problema al usar TADOQuery en tiempo de ejecución

Buenas tardes tengo una unidad con lo siguiente:
Código Delphi [-]
Procedure Ta.qEx(Tq1:TADOQuery;Q:String;T:Integer);

Var F: TForm;
Begin
  if Not (Assigned(Tq1)) Then
  begin
    F:= TForm( Application.FindComponent(Owner.Name) );
    Tq1            := TADOQuery.Create(Nil);
    Tq1.Connection := TADOConnection(F.FindComponent('Cnn'));
  end;

  if Tq1.Active
  then
    Tq1.Close;
  Tq1.SQL.Clear;
  Tq1.SQL.Add(Q);
  If T=1
  Then Tq1.Open
  Else
    Begin
      Tq1.ExecSQL;
      Tq1.Close;
    End;
End;
Y la mando a llamar desde mi form asi:
Código Delphi [-]
Tq := TADOQuery.Create(Nil);

  Tq.Connection:= Cnn;

  qSql:='Select * From ctFacturaIVA';
  fA.qEjecuta(Tq,qSQL,1);
  ........
  ........
  FreeAndNil(Tq);
Hasta ahi funciona bien, el problema es si quiero mandar a:

Código Delphi [-]
  
  qSql:='Select * From ctFacturaIVA';
  fA.qEjecuta(Tq,qSQL,1);

sin un create previo, ahora, cae en que no esta Assigned, por lo que lo crea, pero me marca error al tratar de obtener datos de ese ADOQuery, ya lo intente con Nil, Application,Owner, self, Tq1 y nailas.....
alguna ayudita?
Responder Con Cita