Last post Aug 18, 2014 01:15 PM by TechWind
Aug 18, 2014 12:43 PM|TechWind|LINK
I am using SQL Server Business Intelligence Development Studio to create a SSRS report with an image in the page header changed on different pages.
In the report 'custome code', I wrote below:
Public Shared Dim MyImg as String
Public Function SetMyImg (ByVal var as Image)
MyImg =ImageToBase64(var , System.Drawing.Imaging.ImageFormat.Jpeg)
Public Function ImageToBase64(ByVal mImage As Image, ByVal format As System.Drawing.Imaging.ImageFormat) As String
Using ms As New MemoryStream()
Dim imageBytes As Byte() = ms.ToArray()
Dim base64String As String = Convert.ToBase64String(imageBytes)
In sql server table, I store the image as "varbinary".
In "References" of the "Custom Code", I added "System.Drawing" as reference, but when I preview the report, I got error message "[BC30002] Type 'image' is not defined".
Thank you in advance! :)
Aug 18, 2014 12:47 PM|Rion Williams|LINK
Is there a particular line that is triggering this message?
In general, if you included the System.Drawing library as a reference, you shouldn't have any issues with using the Image class (without having to fully qualify it as System.Drawing.Image). You may need to ensure that you have the appropriate Imports
statement to use the library as well :
Do you have any additional information regarding your exact error or where it is being triggered from?
Aug 18, 2014 01:05 PM|TechWind|LINK
The line that triggers the error message is:
Public Function SetMyImg (ByVal var as Image).
If I changed "Image" to "Object", the report works well in develop mode. But once we move the report the production server, the image in the page header doesn't change with the changing content in different pages. Other fields on the page header are string
type, they are working fine - changes with the changing content in different pages, only image field doesn't work. That why I am thinking to change image to string.
I tried to put "Imports System.Drawing" at the every beginning of the code. But I got error message:"[BC30465] 'imports' statements
must precede any declarations".
Thanks again for your kindly help!
Aug 18, 2014 01:15 PM|TechWind|LINK
I referenced the link below to do my SSRS report: