Skip to main content

I am trying to load and view in listview k2 records of files stored in sql database as image datatype.

Using smartobjects it always failed.

 

I tried all and it failed since yesterday, I am stuck to this problem.

 

sample image type stored in sql

 

0x504B030414000600080000002100A674045285010000AC070000130008025B436F6E74656E745F54797065735D2E786D6C20A2040228A000020000000000000000000000000000000000000000000

 

For your guidance, thanks.

1.  Are you using a SmartBox SmartObject or a seperate database via the SQL Server service instance?


 


2.  Usually the datatype flow will be as below:


 


SQL nvarchar(max) <---> SmartObject Image type <---> ListView Image Attachment control/datatype


 


The SmartObject layer will write the image into the SQL nvarchar(max) field as:


 


<image><name>Image 001.png</name><content>iVBORw0KGgoAAAANSUhEUgAABXcAAAEWCAIAAACi0zPUAAD//0lE.....</content></image>


 


*where <content /> is the base64 encoded string


Hi,

I am using a separate SQL database connecting via smartobject.

from image datatype in smartobject it becomes a memo. even If changed it to Image it failed.

 

Actually when I tried to search using smartobject tester it gives me an error.

 

"String or binary data would be truncated.

The statement has been terminated."


Hi Dabuskol,

 

"String or binary data would be truncated. The statement has been terminated" most probably means that the size of value you want to insert or store is larger than column size or variable size. 

 

Change your sql table storage type from Image  to nvarchar  or Text  data type.

 

Here you are storing 64bit format of image hence  while accessing  use html image tag (using data label  expression ) to show it  as image.

 

where ur Image tag should  have src attribute value starting with data&colon;image/mImage Type];base64,

 

 

<img src='data&colon;image/jpeg;base64,UserImage'> // UserImage is variable having base64 data of image

Let me know if this helps you


Reply