Ver Mensaje Individual
  #2  
Antiguo 24-06-2004
Avatar de delphi.com.ar
delphi.com.ar delphi.com.ar is offline
Federico Firenze
 
Registrado: may 2003
Ubicación: Buenos Aires, Argentina *
Posts: 5.932
Reputación: 27
delphi.com.ar Va por buen camino
Simplemente puedes guardar en una variable del tipo TBookmark el puntero al registo que desees, y luego puedes acceder directamente a este registro mediante él método GotoBookmark.

Este ejemplo lo saqué de la ayuda de Delphi 5:
Código Delphi [-]
procedure TForm1.CopyDataClick(Sender: TObject);

var
   SavePlace: TBookmark;
   PrevValue: Variant;
begin
   with Table1 do
   begin
    { get a bookmark so that we can return to the same record }
    SavePlace := GetBookmark;

    { move to prior record}

    FindPrior; 

    { get the value }

    PrevValue := Fields[0].Value;

    {Move back to the bookmark 

    this may not be the next record anymore 
    if something else is changing the dataset asynchronously }
    GotoBookmark(SavePlace);
    { Set the value }
    Fields[0].Value := PrevValue;
    { Free the bookmark }
    FreeBookmark(SavePlace);
  end;

end;

Otra opción es usar un TBookmarkStr:
Código Delphi [-]
var
  Bookmark: TBookmarkStr;
begin
  Bookmark := DataSet.Bookmark;
  try
    DataSet.First;
    while not DataSet.EOF do
    begin
      ...
      DataSet.Next;
    end;
  finally
    DataSet.Bookmark := Bookmark;
  end;

Saludos!
__________________
delphi.com.ar

Dedique el tiempo suficiente para formular su pregunta si pretende que alguien dedique su tiempo en contestarla.
Responder Con Cita