Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Unable to view images in report viewer

Status
Not open for further replies.

NotSQL

Technical User
May 17, 2005
205
GB
Hi, can someone help me as I’m a new to reporting services... I've imported an image to a report but after deploying to the web server im unable to view it. The image is stored in sql server 2005 database as a binary data type.

Any help would be appreciated
 
There is an image data type in SQL Server 2005. Have you tried using the image data type?
 
Unfortunately i don’t have that option as it’s a customer’s database..
 
I have used something like this in the past - goes in the code block within the report:

Code:
Public Shared Function CleanPhoto(ByVal SourcePhoto As Byte()) As Byte()

        'Declare variables
        Dim PhotoString As String = System.Convert.ToBase64String(SourcePhoto)
        Dim RetVal As Byte()

        'Calculate and remove OLE headers if present
        If (PhotoString.Substring(0, 10) = "FRwvAAIAAA") Then
            RetVal = System.Convert.FromBase64String(Mid(PhotoString, 105))
        Else
            RetVal = SourcePhoto
        End If

        Return RetVal

    End Function

You would call it by using =CleanPhoto(Fields!PhotoField.Value)

Rgds, Geoff

We could learn a lot from crayons. Some are sharp, some are pretty and some are dull. Some have weird names and all are different colours but they all live in the same box.

Please read FAQ222-2244 before you ask a question
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top