ich hau mal denn ganzen quell text rein vielleicht bringt das hilfe
Delphi-Quellcode:
type
TForm2 = class(TForm)
MainMenu1: TMainMenu;
OpenPictureDialog1: TOpenPictureDialog;
SavePictureDialog1: TSavePictureDialog;
Button1: TButton;
Button2: TButton;
odBlob: TOpenDialog;
sdBlob: TSaveDialog;
DBCtrlGrid1: TDBCtrlGrid;
Photo: TImage;
Procedure btnLoadClick(Sender: TObject);
procedure tclientdatasetAfterScroll(DataSet: TDataSet);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form2: TForm2;
implementation
{$R *.dfm}
uses Unit1, ABOUT;
procedure TForm2.TclientdatasetAfterScroll(DataSet: TDataSet);
var
JpegImage: TJPEGImage;
BlobStream: TStream;
begin
if (not Tclientdataset.FieldByName('Arbeitsvertragimg').IsNull) then
begin
BlobStream := Tclientdataset.CreateBlobStream(Tclientdataset.FieldByName('Arbeitsvertragimg'),bmRead);
JpegImage := TJPEGImage.Create;
try
JpegImage.LoadFromStream(BlobStream);
Photo.Picture.Assign(JpegImage);
Photo.Visible := True;
finally
JpegImage.Free;
BlobStream.Free;
end;
end
else
Photo.Visible := False;
end;
procedure TForm2.btnLoadClick(Sender: TObject);
var
FileStream: TFileStream;
BlobStream: TStream;
begin
if sdBlob.Execute then
begin
Tclientdataset.Edit;
BlobStream := nil;
FileStream := TFileStream.Create(sdBlob.FileName,fmCreate);
try
BlobStream := Tclientdataset.CreateBlobStream(Tclientdataset.FieldByName('Arbeitsvertragimg'),bmRead);
FileStream.CopyFrom(BlobStream,BlobStream.Size-BlobStream.Position);
Tclientdataset.Post;
Tclientdataset(Tclientdataset);
finally
BlobStream.Free;
FileStream.Free;
end;
end;
end.