Can not save JPEG Image to Image Field

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Posts: 15
Joined: Wed 01 Feb 2006 05:56

Can not save JPEG Image to Image Field

Post by ekarasu » Tue 07 Feb 2006 08:24

I can not save a jpeg image to a image field. I use the following code:

TJPEGImage *jp;
TStream *Stream1=NULL;
Stream1 = Query->CreateBlobStream(Query->FieldByName("Logo"), bmWrite);

I don't get an error message but there is nothing written to the database either. I am sure that jp holds the related image.

Posts: 1693
Joined: Thu 28 Oct 2004 13:56

Post by Ikar » Tue 07 Feb 2006 08:36

You can find similar Delphi example in Sdac\Demos\Win32\Pictures\ folder. We don't have samples other than included in the installation package.

Posts: 39
Joined: Fri 16 Dec 2005 07:41

Post by tinof » Tue 07 Feb 2006 12:00

I had a similar problem, the following sequence solved it :

query.fieldbyname('MyBlobField').Clear; // i think THIS is it !
stream.Write(data,len); // should work with savetostream too

Maybe it can help

Post Reply