PDA

Ver la Versión Completa : GotoBookMark record not found


Jere_84
24-05-2012, 16:41:10
Este código funcionaba correctamente en versiones de delphi 6, pero al trasladarlo a Delphi 2010 sale el error "ClientDataSet record not found". Alguien sabe cual puede ser el problema.


bmReg := GetBookmark;
try
sPredAnt := FieldByName( 'Prede' ).AsString;
if (sPredAnt = 'P') or Locate('Prede', 'P', []) then
begin
Edit;
FieldByName( 'ImagenPrede' ).Assign( TBitmap.Create );
FieldByName( 'Prede' ).AsString := ' ';
Post;
end;
finally
GotoBookMark(bmReg); <----Aqui da el error


Slds.

ecfisa
24-05-2012, 21:02:31
Hola.

A partir de Delphi 2009 GetBookmark devuelve un puntero a TBytes.

Probá haciendo:


var
bmReg: TBookmark; // <== este cambio
begin
...
bmReg := GetBookmark;
try
sPredAnt := FieldByName( 'Prede' ).AsString;
if (sPredAnt = 'P') or Locate('Prede', 'P', []) then
begin
Edit;
FieldByName( 'ImagenPrede' ).Assign( TBitmap.Create );
FieldByName( 'Prede' ).AsString := ' ';
Post;
end;
finally
GotoBookMark(bmReg);
end;
...


Saludos.

Edito: No podía encontrar el artículo donde lo había leido, lo acabo de ubicar : Release Notes for Delphi 2009 ... (http://support.embarcadero.com/article/38475)

Jere_84
30-05-2012, 00:49:05
Hice el cambio a Pointer y el error sigue dando, hice una prueba y comente estas dos lineas de mi codigo:

FieldByName ( 'ImagenPrede' .) Asignar (TBitmap.Create);
FieldByName ( 'Prede' ). AsString: = "" ;


Y el error no ocurre porque sera que al editar los campos ocurre el error: ClientDataSetCliente: Record not found.
Que método alternativo podría utilizar?