Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more
Hi, all,
I have a byte array (image) in json format in sql db. I extract the image out and also in json format. my query is:
SELECT thumbNail FROM Table
cross apply openjson(CMD_LIST,'$.queueMessagePages')
with
(pageNo Int '$.pageNo',
[thumbNail] nvarchar(max) as JSON
) as jsonsvalues where ...
Then I get the thumbnail in nvarchar(max).
In the report builder, I customize a function to convert the byte array into hex string. the function is like:
Function ToHexString(ByVal bytes() As Integer) As String
Dim strB As New System.Text.StringBuilder
Dim ints(bytes.Length) As Integer
Dim N as long
For N = 0 To bytes.Length - 1
If bytes(N) < 0 Then
ints(N) = bytes(N) + 256
Else
ints(N) = bytes(N)
End If
Next
For N = 0 To ints.Length - 1
If ints(N) < 16 Then
strB.Append("0" & Hex$(ints(N)))
Else
strB.Append(Hex$(ints(N)))
End If
Next
ToHexString ="0x" & Replace(strB.ToString().ToUpper(), " ", "")
Return ToHexString
End
I tried to run this function in vb,net can get the hex string correctly. but cannot get the image in report builder.
Please help to visualize the image in report builder if you have any experience. Thank you!
The rdl supports Byte Array so you do not need to convert to hex! We have been converting the hex to bytearray if at all! Try to put this on a Dataset field and bind that to the image control. Also just to make sure the image mime is as of the original one.
Thank you for your reply. but my byte array is saved as varchar(max) in database, it is a string with byte array value. is it still ok for report builder to visualize it?
Yeah it should work! try adding this convert
Convert.FromBase64String
I tried add the convert and not add, but both not work for me.
Hi, @Tengmin123
After my search, I'm afraid that vb language is not supported .
Sorry, I have no experience in this area. I only used the following method to add images to the desktop. You can reference:
How to upload multiple images to SQL Server (sqlshack.com)
Best Regards
Janey Guo
Thank you for your reply.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 5 | |
| 3 | |
| 2 | |
| 1 | |
| 1 |
| User | Count |
|---|---|
| 10 | |
| 7 | |
| 5 | |
| 4 | |
| 4 |