SSRS Tutorial 59 - How to Create Report that Get Image from Database Table in SSRS

In this video " How to create Report that gets Images from Database Table" we are going to learn below items
  1. How to Create Sample Table and Store Images to it in SQL Server
  2. How to create New Empty Report and Create Data Set Including Image Field from Table
  3. How to use Image Item in SSRS Report and Map to Image Field from Table
  4. Learn Image Item Properties to fit Image properly in SSRS Report



Sample script for the SSRS Report
--drop table [dbo].[TotalSale]
CREATE TABLE [dbo].[TotalSale] (
    [id] [int] NOT NULL
    ,[SalePersonFName] [varchar](100) NULL
    ,[SalePersonLName] [varchar](100) NULL
    ,[ProductName] [varchar](100) NULL
    ,[ItemsSold] [int] NULL
    ,[SoldPrice] [float] NULL
    ,[SoldDate] [date] NULL
    ,[City] [varchar](100) NULL
    ,[State] [varchar](100) NULL
    ,[Country] [varchar](100) NULL
    ,[Region] [varchar](100) NULL
 ,SalePersonImage VARBINARY (MAX) NOT NULL
    )

INSERT [dbo].[TotalSale] (
    [id]
    ,[SalePersonFName]
    ,[SalePersonLName]
    ,[ProductName]
    ,[ItemsSold]
    ,[SoldPrice]
    ,[SoldDate]
    ,[City]
    ,[State]
    ,[Country]
    ,[Region]
 ,SalePersonImage
    )
Select
    1
    ,N'Aamir'
    ,N'Shahzad'
    ,N'TV'
    ,1
    ,700
    ,CAST(N'2015-07-15' AS DATE)
    ,N'Charlotte'
    ,N'NC'
    ,N'USA'
    ,N'North America'
 ,BulkColumn
FROM OPENROWSET (BULK 'C:\Users\ashahzad\Desktop\InputFolder\Aamir.png', SINGLE_BLOB) 
AS SalePersonImage
 
Union All
Select
    2
    ,N'M'
    ,N'Raza'
    ,N'Cell Phone'
    ,2
    ,800
    ,CAST(N'2015-07-15' AS DATE)
    ,N'Charlotte'
    ,N'NC'
    ,N'USA'
    ,N'North America'
  ,BulkColumn
FROM OPENROWSET (BULK 'C:\Users\ashahzad\Desktop\InputFolder\Aamir.png', SINGLE_BLOB) 
AS SalePersonImage




How to Get Image from Database Table and Display in SSRS Report - SSRS Tutorial


  Check out related Posts / Videos 

 
 

No comments:

Post a Comment