Report expression converting binary data type to string
Hi everyone,
I am creating report using SSRS 2008 and I am trying to display sql data type = image which is translated to binary into a text field on the report and I am trying to figure out the expression I need to place. I tried
=Cstr(Fields!TASK_RTF_NOTES.Value) but it does not work.
Has anyone had similar problem like me?
Thanks in advance,
Kal
June 13th, 2011 9:53am
Hi again,
Can anyone advise me please?
Thanks
Free Windows Admin Tool Kit Click here and download it now
June 15th, 2011 3:14am
Hi Kaly81,
From your description, you need to convert the binary data type to string. You can try to use a Microsoft .NET base64 encoding mechanism to convert the data between binary and string types.
Based on your environment, please try to use the expression below:
=Convert.ToBase64String(Fields!TASK_RTF_NOTES.Value)
For more information, please refer to “Image Value Referring to a Text-Box Value” section in this link:
http://msdn.microsoft.com/en-us/library/bb395166(v=sql.90).aspx
Thanks,
Bin Long
June 15th, 2011 11:16pm
Hi Bin,
I tried the following:
=Convert.ToBase64String(iif(IsNothing(Fields!TASK_RTF_NOTES.Value),
"N/A", Fields!TASK_RTF_NOTES.Value)) but I get the following error:
[rsRuntimeErrorInExpression] The Value expression for the textrun ‘TASK_RTF_NOTES.Paragraphs[0].TextRuns[0]’ contains an error: Unable to cast object of type 'System.String' to type 'System.Byte[]'
Do you have an idea what the problem might be?
Free Windows Admin Tool Kit Click here and download it now
June 16th, 2011 6:16am