Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2013-07

How to assign a image file for a variable as Blob

2 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Johan Tu Toit

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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20130726/f3ef215a/attachment.html>

Reply by email

Edgar Muniz Berlinck
to Johan Tu Toit

*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;*
Johan Tu Toit wrote 21 lines
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 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.freepascal.org/pipermail/lazarus/attachments/20130726/e9333e82/attachment.html>

Reply by email