Image is not being saved into SQL Server Database


Badge +3

Hi,

 

I have created a table on SQL server  which stores images (image column datatype : nvarchar(MAX)). After creating the smartobject using this table, I have edited the smartobject properties and changed the datatype to 'Image'.  I am developing a form, which uses this image table smartobject  to populate pre-stored images on the form.

 

During runtime, the image gets pouplated without any issues on the form. But once I click the create button, all the data on the form gets saved into the SQL table dedicated for the form, except for the image, which shows as NULL.

 

 

Has anyone experienced this issue before?  Please guide me on this issue.

 

Regards

Sami


13205i8E81DBF947290CEF.jpg
14047iAEF7246CBE5E159A.jpg

5 replies

Badge +1

Hey,

 

Could you please show us the mapping properties of the method create? In the rules.

 

Thank you.

JJ

Badge +3

Hi JJ,

 

Thank you for your response. Please find attached the input mappings, output mappings and the sample form that I am creating. 

One thing is that, when I upload the image as an attachment from the form, it gets saved to the database upon clicking create, but when I use a drop-down list, the image gets populated on the form but it doesn't get saved to the database when I click create. 

Any advice would be greatly appreciated.

 

Regards,

Sami.


11230i5F2ACFD64386983E.jpg
11598i6333FCCF8A04559D.jpg
14820i4A7B8F7D7F5864E9.jpg
Badge +2

Your input mapping is wrong for "ItemImage". You should be assigning Image attachment, not the dropdown. It will authomatically pick up the binary data when you assign attachment there.

 

I am not sure why you have chosen to assign dropdown to "ItemImage". In this case, "ItemImage" is of type "Image" in your SMO, and you are trying to set the value for that with dropdown which only will have selected value as "Text", so there is a mis-match of data being passed which results in no data being stored for "ItemImage".

 

Hope this helps.

Badge +3

Thank you for your reply. I have updated my mappings as per your suggestions but still the image doesn't get saved to the database. The image column shows as null. (please see attachments) Since the 'image' datatype of smartobject has to write the output to the SQL column of type 'nvarchar', could there be an issue with the data type?  Please suggest.

 

Regards,

Sami.


11826iA6CC465B13AA2B0E.jpg
13086i39FB1D1DCA346DD2.jpg
Badge +2

Hi Sami,

 

I just created one sample to test out image upload. Check out the design of View, SMO, DB Table and DB SPs below and in attached image. This should answer your query about mapping, db & smo data types.

 

 

10986iDCC52D4713809C77.png

 

Please let me know if this helps.

 


14131i0E55979ECC0120D9.png

Reply