Subject Re: TBlobField problem
Author Thomas Steinmaurer
Hi Tilo,

try to insert following line:

...
imgJPG := TJpegImage.Create;
imgJPG.LoadFromFile(sFileName);
imgJPG.SaveToStream(strJPG);
strJPG.Position := 0; //<---------- insert this line!
...

Hope this helps!

Thomas Steinmaurer

--- In IBObjects@y..., "Tilo Muetze" <tmuetze@i...> wrote:
> Hello,
> sorry if this question is too dumb but it seems I cannot find a
solution:
> I'm trying to save a jpg image to a BLOB column with this code:
>
> var
> strJPG: TStream;
> imgJPG: TJpegImage;
> begin
> try
> strJPG :=
> ibqryPicture.CreateBlobStream(ibqryPicture.FieldByName('PICTURE'),
> bmReadWrite);
> imgJPG := TJpegImage.Create;
> imgJPG.LoadFromFile(sFileName);
> imgJPG.SaveToStream(strJPG);
> ibqryPicture.Edit;
> TBlobField(ibqryPicture.FieldByName('PICTURE')).LoadFromStream
(strJPG);
> ibqryPicture.Post;
> finally
> strJPG.Free;
> imgJPG.Free;
> end;
> end;
>
> 'ibqryPicture' is a TIBOQuery
> 'sFileName' is a string variable which holds the complete filename
to the
> jpg file
>
> The code seems really simple but after posting ibqryPicture the
Field
> 'PICTURE' is still null. Do you see any reason for that?
>
> We use: D6 Pro, IBO 4.2 Eg with TIBOx components
>
> Regards,
> Tilo Muetze