[Lazarus] How to assign a image file for a variable as Blob

Edgar Muniz Berlinck edgar.vv at gmail.com
Fri Jul 26 19:05:09 CEST 2013


*Try something like this.*

*procedure* SavePictureToDatabase;*var*
  BlobField: TField;
  BS: TStream;*begin*
  *with* Query1 *do*
  *begin*
    Insert;
    BlobField := FieldByName('picturefield');
    BS := CreateBlobStream(BlobField,bmWrite);
    Bitmap.SavetoStream(BS);
    Post;
  *end;**end;*



On Fri, Jul 26, 2013 at 12:27 PM, Johan Tu Toit <johan.tutoit at gmail.com>wrote:

> Hi all,
> Please I tried the above statment:
>
> DataModuleConn.SQLQuery.Params.ParamByName('getPHOTO').AsBlob:=image1.Picture.LoadFromFile(OpenPictureDialog1.FileName);
> its giving error:
> image.pp(358,155) Error: Incompatible type for arg no. 1: Got "untyped",
> expected "AnsiString"
> image.pp(400) Fatal: There were 1 errors compiling module, stopping
>
> The type assigned its wrong.
>
> Thanks
>
>
> --
> _______________________________________________
> Lazarus mailing list
> Lazarus at lists.lazarus.freepascal.org
> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
>
>


-- 
Edgar Muniz Berlinck
http://about.me/edgarberlinck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20130726/e9333e82/attachment-0003.html>


More information about the Lazarus mailing list