Acces y TGraphic field
Publicado por BigLuis (463 intervenciones) el 26/02/2003 16:33:32
Tengo que recuperar las imagenes almacenadas en una base de datos Access con una tabla con dos campos, uno Integer con un numero de foto y otro graphic con la foto embebida, que está muy mal diseñada y construida, para tratar de hacer otra un poco más solida y menos "pesada".No quiero ir registro a registro editando las imagenes con el editor de Microsoft.Desde Delphi, atacandola con ADO es imposible visualizar las imagenes. Intento utilizar el siguiente procedimiento (en algun sitio leí que funcionaba) y me da error en el Stream al cargarlo en una TImage. ¿Alguien sabe porque?.
procedure TForm1.SpeedButton7Click(Sender: TObject);
var
Stream:TBlobStream;
Size:Integer;
begin
try
Stream:=TBlobStream.Create(Adodataset1foto,bmRead);
Image1.Picture.Bitmap.LoadFromStream(StreamOut);
{Stream:=TBlobStream.Create(Adodataset1Foto,bmRead);
SetLength(s, Stream.Size);
Stream.Read(s[1], Stream.Size);
Application.ProcessMessages;
size := Stream.Size;
StreamOut.Write(size, SizeOf(size));
StreamOut.Write(s[1], size);
Application.ProcessMessages;
StreamOut.SaveToFile(inttostr(Adodataset1Registro.Value));}
finally
Stream.Free;
end;
end;
procedure TForm1.SpeedButton7Click(Sender: TObject);
var
Stream:TBlobStream;
Size:Integer;
begin
try
Stream:=TBlobStream.Create(Adodataset1foto,bmRead);
Image1.Picture.Bitmap.LoadFromStream(StreamOut);
{Stream:=TBlobStream.Create(Adodataset1Foto,bmRead);
SetLength(s, Stream.Size);
Stream.Read(s[1], Stream.Size);
Application.ProcessMessages;
size := Stream.Size;
StreamOut.Write(size, SizeOf(size));
StreamOut.Write(s[1], size);
Application.ProcessMessages;
StreamOut.SaveToFile(inttostr(Adodataset1Registro.Value));}
finally
Stream.Free;
end;
end;
Valora esta pregunta


0