Board index » delphi » Save the image into SQL Database?

Save the image into SQL Database?

I want to insert the the image into database, I used following code, but it
can't work:

xxx.insert;
xxx.FieldByName('photo').AsBlob := imagebox1.Graphic;

Please help me to slove this problem!

 

Re:Save the image into SQL Database?


any solution would be appriciated by me, too. Delphi4 Help + manual aren't
very helpful

thanks in advance

M. Ostrowski

RC <raymondch...@hkid.com> schrieb in im Newsbeitrag:
85ohcj$9p...@bornews.borland.com...

Quote
> I want to insert the the image into database, I used following code, but
it
> can't work:

> xxx.insert;
> xxx.FieldByName('photo').AsBlob := imagebox1.Graphic;

> Please help me to slove this problem!

Re:Save the image into SQL Database?


var
   ABlogStream: TBlobStream;
begin

ABlobstream := TBlobstream.Create(xxx.FieldByName('QPHOTO').AsBlob,
bmWrite);
  try
    imagebox1.picture.graphic.SaveToStream(ABlobstream);
    xxx.Post;
  finally
    ABlobStream.Free;
  end;
end;

John

Other Threads