Page 1 of 1

mysql: insert into tablename pixfield=

Posted: Thu 07 Oct 2010 22:02
by crownfield
mysql.sql.text:= ' insert into tablename set pixfield= ' + thepicture ???

where thepicture is from some vcl component, like Image1.picture?

how, in MYSQL, do I insert an image from a vcl into the table?

Posted: Fri 08 Oct 2010 13:07
by AndreyZ
Hello,

You can use the following code:

Code: Select all

  Image.Picture.Bitmap.SaveToStream(ms); // where ms is TMemoryStream
  MyQuery.SQL.Text := 'insert into your_table(img) values(:img)';
  MyQuery.ParamByName('img').LoadFromStream(ms, ftBlob);
  MyQuery.Execute;