Ver Mensaje Individual
  #2  
Antiguo 30-03-2010
Avatar de tgsistemas
tgsistemas tgsistemas is offline
Miembro
 
Registrado: dic 2003
Ubicación: Barcelona
Posts: 149
Reputación: 21
tgsistemas Va por buen camino
respondo yo mismo y sigo consultando

Código Delphi [-]
function DimeCentroDiet(VDiet:Int64):Int64;
var
  MiQry : TZReadOnlyQuery;
  isql : string;
begin
  isql := 'select cntroasig from tb02D where cdgo = :cdgotemp';

  try
    MiQry := TZReadOnlyQuery.Create(nil);
    with MiQry do
    begin
      //Parent := FInsertar;
      MiQry.Connection := Data.ZConnectTGS;
      MiQry.SQL.Clear;
      MiQry.sql.Text := isql;
      MiQry.ParamByName('cdgotemp').Value := VDiet; 
      MiQry.Open;

      if MiQry.RecordCount >0 then begin
        Result := MiQry.fields[0].value;
      end else begin
        Result := 0;
      end;
    end;
  finally
    MiQry.Close;
    MiQry.Free;
  end;
end;

hasta ahí todo correcto según creo.
Pero ahora hago el proceso inverso, pasarle a otro campo de otra tabla el valor de la rutina anterior :

Código Delphi [-]
zqryParts.fieldbyname('centro').value = DimeCentroDiet(DM1.usudiet);
produce el error "no se puede acceder al campo 'centro' como Variant"... pero no entiendo por qué es variant.
__________________
Toni | blog
Responder Con Cita