Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   Conexión con bases de datos (https://www.clubdelphi.com/foros/forumdisplay.php?f=2)
-   -   Problema con locate (https://www.clubdelphi.com/foros/showthread.php?t=15326)

Telemaco 19-10-2004 10:04:26

Problema con locate
 
Estoy intentado localizar un registro de la bd (sql server 2000) y posicionarme en el, para ello he utilizado la funcion locate (trabajo con tablas AD0)


Código:

procedure TForm1.BLocalizaClick(Sender: TObject);
 function LocateValue: Variant;
  var
        I: Integer;
        Values: TStringList;
  begin
        if Pos(',', LocateEdit.Text) < 1 then
          LocateValue := LocateEdit.Text
        else
        begin
          Values := TStringList.Create;
          try
                Values.CommaText := LocateEdit.Text;
                Result := VarArrayCreate([0,Values.Count-1], varVariant);
                for I := 0 to Values.Count - 1 do
                  Result[i] := Values[i];
          finally
                Values.Free;
          end;
        end;
  end;
 
 var
  Options: TLocateOptions;
 
 begin
  Options := [];
  if locPartialKey.Checked then Include(Options, loPartialKey);
  if ADOTable1.Locate(LocateField.Text, strtoint(LocateValue), Options)
        then showmessage('Albaran encontrado')
        else Showmessage('Albaran no encontrado, prueba de nuevo');
 end;

me dice que lo encuentra pero no me posiciona en el registro, siempre en el primero, podria alguien indicarme que es lo que estoy haciendo mal? :confused:

gracias.


La franja horaria es GMT +2. Ahora son las 20:30:23.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi