Inserting jpeg images

Inserting jpeg images

Postby Ray V » Thu 20 Jan 2005 11:42

I am just moving over to MyDac from dbExpress because I am now using MySQL 4.1.7.and Delphi 6.
The following snippet attempts to insert a record with a few text fields and also a
jpeg photo into a blob field from an image on the form. This fails with the message 'Datatype is not supported'.

This used to work with dbExpress.
It works ok with MyDac if I remove the jpeg part.
Uses clause contains 'jpeg'.

Any suggestions gratefully received.


MyQuery1.SQL.Clear;
MyQuery1.SQL.Add('INSERT INTO idcards (Id,surname,othername,photo) VALUES (:id,:surname,:othername,:photo)');
MyQuery1.Params[0].AsString:='A12345';
MyQuery1.Params[1].AsString:='Bloggs';
MyQuery1.Params[2].AsString:='Joe';
MyQuery1.Params[3].Assign(Image1.Picture.Graphic);
MyQuery1.Execute;


Regards

Ray V
Ray V
 
Posts: 1
Joined: Thu 20 Jan 2005 11:38

Re: Inserting jpeg images

Postby Ikar » Fri 21 Jan 2005 07:58

Please set Param Datatype:

MyQuery1.Params[3].DataType := ftBlob;
MyQuery1.Params[3].Assign(Image1.Picture.Graphic);
MyQuery1.Execute;
Ikar
 
Posts: 1693
Joined: Thu 28 Oct 2004 13:56


Return to MySQL Data Access Components