ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Post to SQL Blob through ImageEnDBView
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

asim122

Saudi Arabia
3 Posts

Posted - Jul 02 2012 :  07:53:52  Show Profile  Reply
Hi,

I am using the following code to post the SQL server blob field through ImageEnDBView in Delphi 5

aStream:=cdsAvDocDetail.CreateBlobStream(cdsAvDocDetail.FieldByName('avImage'), bmWrite);
ImageEnDBView.Io.SaveToStreamBMP(aStream);
cdsAvDocDetail.Post;
aStream.Free;

and to retrive

aStream:=cdsAvDocDetail.CreateBlobStream(cdsAvDocDetail.FieldByName('avImage'), bmRead);
ImageEnDBView.IO.LoadFromStreamBMP(aStream);
aStream.Free;
ImageEnDBView.IO.Update;

It isn't working and blob is being posted as null, with either AutoDisplay set to True or False, Please help.

Regards,
Asim

xequte

39109 Posts

Posted - Jul 02 2012 :  19:10:33  Show Profile  Reply
Hi

Before calling LoadFromStreamBMP you should reset the stream position:

aStream.Position := 0;


Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Go to Top of Page

asim122

Saudi Arabia
3 Posts

Posted - Jul 02 2012 :  23:07:42  Show Profile  Reply
Thanks Nigel,

But the main problem is that, the image field is not being updated, it keeps null, so retrieval would be the subsequent aspect, had added the retrival code just for completeness.

Regards,
Asim
Go to Top of Page

asim122

Saudi Arabia
3 Posts

Posted - Jul 03 2012 :  02:33:50  Show Profile  Reply
Thanks Nigel,

It has been resolved wirhout the need of streams, the problem was with the code that had been setting DataSource:= nil for ImageEn control when files were to be saved to physical location.

Regards,
Asim
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: