Display Database Image using MS SQL Server 2008 Reporting Services
原文 Display Database Image using MS SQL Server 2008 Reporting Services
With the new release of MS SQL Server 2008 Reporting Services has introduced a new feature that will help report developers (Business Intelligence BI professionals) to display images stored in database tables.
Since Microsoft SQL Server Reporting Services is gaining power in covering the requirements of business intelligence developers day by day, it is gaining more acceptance from the BI professionals.
For building a Microsoft Reporting Services solution to display database image or display image from database, we will first create sql database image table and insert images into the sql database for populating table with sample data.
Of course you should either create a new MS Reporting Services solution or open an existing MS Reporting Services solution and add reporting services report to this solution.
Prepare SQL Database and Populate with Sample Images in order to use in Reporing Services Report
First of all by executing the below t-sql Create Table command sql database administrators can create the database table in which sql developers will store images or image files in binary format in avarbinary(max) data type column.
CREATE TABLE DBFiles (
id int IDENTITY(1,1) NOT NULL,
fname nvarchar(1000) NOT NULL,
[file] varbinary(max)
)
Save Image in SQL Database in Binary Format
After we have created the sql database table to store the image files, now we can begin inserting images into the newly created sql database table.
You can also refer to SQL tutorial Save Image to Database Table in SQL Server for an other example.
INSERT INTO DBFiles(fname, [file])
SELECT 'Reporting-Services-2008-enriched-visualization-gadgets.jpg', * FROM OPENROWSET(
BULK N'C:\Reporting-Services-2008-enriched-visualization-gadgets.jpg',
SINGLE_BLOB
) rs;
INSERT INTO DBFiles(fname, [file])
SELECT 'what-is-new-with-SQL-Server-2008.jpg', * FROM OPENROWSET(
BULK N'C:\what-is-new-with-SQL-Server-2008.jpg',
SINGLE_BLOB
) rs;
You can download the sample image files photos I've taken during TechEd Developers 2007 related withMS SQL Server 2008 and MS SQL Server Reporting Services 2008 from the following links :
Reporting Services 2008 enriched visualization gadgets
What is new with SQL Server 2008
Let's see how images we have inserted into the sql table is seen when we execute a SELECT statement.
SELECT * FROM Files
Now we have created our sample sql table and populate the image table with sample image files.
We can now create our MS SQL Server Reporting Services 2008 report which will display the image files stored in the SQL Server database table.
Build SQL Reporting Services DataSet for Sample Report
First of all, we will create a dataset for reading data from SQL Server database image table.
We will use this dataset for databinding to reporting services table control and image control within the table cells for each row in the sql image table.
The sql query for the dataset is : SELECT * FROM DBFiles
This t-sql query will supply the sql data in binary format which we will display using Reporting Services.
Design Reporting Services Report in order to Display Database Image
After the dataset of the SQL Reporting Services report is prepared, now we can switch to the design view.
Place a table onto the Design surface of the SSSRS 2008 report.
Then set the DataSetName property of the new Tablix component to the dataset we have created for this sample report.
Then set field properties or the columns of the report design view tablix component as you wish.
Select the Reporting Services image component from the Toolbox and drag and drop into an emptytablix column.
This action will trigger the Reporting Services Image Properties Wizard.
You can later alter the properties of the image cell by a click on the image properties menu item on the context menu of the image cell.
Set the image properties as follows :
1) Set the image source as database, since we are selecting the image in binary format from database using reporting services dataset.
2) When database is chosen as the source of the image, you will select the field name as [file] field of the dataset in the Use this field dropdown list.
3) Also as the last step select the MIME type as image/jpeg (or which is approtiate for your case)
Resize Database Image and Size Properties of the SQL Database Image
You can also set the size properties of the database image and image component within the tablixcomponent by displaying the image properties and navigating to the Size tab.
There you can select one of the following size properties for display database images.
Original size
Fit to size
Fit proportional
Clip
I have selected fit proportional option which will resize image to fit inside the item while maintaining the aspect ratio.
Display Database Image on a SQL Server Reporting Services Report
After we have finished developing the MS SQL Server 2008 Reporting Services report, if you switch to the preview tab we can see the images stores in sql table on our sample SSRS report.
Display Database Image using MS SQL Server 2008 Reporting Services的更多相关文章
- SQL SERVER 2008 Reporting Services 的一些小问题集合
实验环境:服务器 Windows Server 2008 R2 Standard 64bit 数据库 SQL SERVER 2008 R2 Standard ...
- 实现SQL Server 2008 Reporting Services匿名访问报表有两种方法
一.通过修改SQL Server 2008的配置文件,去掉Windows的验证. 1.首先我们找到SQL安装目录下的两个Web.config配置文件,默认安装目录分别是(C:\Program File ...
- Set up JBPM5.4 Final Installer to use MS SQL Server 2008 using JTDS(转)
[-] A What I Am Going To Do B The Setup Steps C Lets Install it A. What I Am Going To Do B. The Se ...
- MS SQL SERVER 2008 使用OBJECT_ID判断临时表是否存在
MS SQL SERVER 2008 使用OBJECT_ID判断临时表是否存在 我们在写sql 脚本的时候经常会用到临时表,有时间也需要根据临时表是否存在做一些逻辑处理.还好sql server已经集 ...
- [翻译]初识SQL Server 2005 Reporting Services Part 3
原文:[翻译]初识SQL Server 2005 Reporting Services Part 3 这是关于SSRS文章中四部分的第三部分.Part 1提供了一个创建基本报表的递阶教程.Part 2 ...
- [翻译]初识SQL Server 2005 Reporting Services Part 4
原文:[翻译]初识SQL Server 2005 Reporting Services Part 4 这一篇是关于SQL Server 2005 Reporting Services四篇文章中最后一篇 ...
- [翻译]初识SQL Server 2005 Reporting Services Part 2
原文:[翻译]初识SQL Server 2005 Reporting Services Part 2 在Part 1文章中我们对SQL Server Reporting Services 2005(S ...
- [翻译]初识SQL Server 2005 Reporting Services Part 1
原文:[翻译]初识SQL Server 2005 Reporting Services Part 1 构建和部署基本报表 如果曾经存在一项工作使得“真正的”开发者给他的上司泡蘑菇,那就是构建报表.毕竟 ...
- 使用SQL Database Migration Wizard把SQL Server 2008迁移到Windows Azure SQL Database
本篇体验使用SQL Database Migration Wizard(SQLAzureMW)将SQL Server 2008数据库迁移到 Azure SQL Database.当然,SQLAzure ...
随机推荐
- lambda 3
.NET笔记系列:LAMBDA表达式常用写法 这里主要是将数据库中的常用操作用LAMBDA表达式重新表示了下,用法不多,但相对较常用,等有时间了还会扩展,并将查询语句及LINQ到时也一并重新整理下 ...
- 解决 - java.lang.OutOfMemoryError: unable to create new native thread
工作中碰到过这个问题好几次了,觉得有必要总结一下,所以有了这篇文章,这篇文章分为三个部分:认识问题.分析问题.解决问题. 一.认识问题: 首先我们通过下面这个 测试程序 来认识这个问题: 运行的环境 ...
- 栈实现java
栈是一种“先去后出”的抽象的数据结构.例如:我们在洗盘子的时候,洗完一个盘子,将其放在一摞盘子的最上面,但我们全部洗完后,要是有盘子时,我们会先从最上面的盘子开始使用,这种例子就像栈的数据结构一样,先 ...
- easyui动力头 && 动态加入tabs
今天,在实现了业务时的,我们需要根据后台操作,以产生多个数据tab页,而且每一个tab页表格根据需要动态生成的标题数据. 返回后台数据格例如,下面的公式: 实现方法例如以下: //$("#c ...
- Linux高性能server规划——多进程编程
多进程编程 多进程编程包含例如以下内容: 复制进程影映像的fork系统调用和替换进程映像的exec系列系统调用. 僵尸进程以及怎样避免僵尸进程 进程间通信(Inter-Process Communic ...
- 【PullToRefresh 系列基本用法】 Android装上拉下拉刷新控制具体的解释
转载请注明:http://blog.csdn.net/duguang77/article/details/40921601 作者信息: Chris Banes大神详情:https://github.c ...
- 在C#环境中动态调用IronPython脚本(一)
本文讲述用C#调用Ironpython运行环境,解析并运行动态pyhton脚本.这种情况应用在那些需要滞后规定行为的场合,例如,动态计算项(计算引擎),用户可以自定义计算内容.计算公式等. 本文的代码 ...
- 返璞归真 asp.net mvc (6) - asp.net mvc 2.0 新特性
原文:返璞归真 asp.net mvc (6) - asp.net mvc 2.0 新特性 [索引页][源码下载] 返璞归真 asp.net mvc (6) - asp.net mvc 2.0 新特性 ...
- 告别乱码,针对GBK、UTF-8两种编码的智能URL解码器的java实现(转)
效果图 字符 字符是早于计算机而存在,从人类有文明那时起,人们就用一个个符号代表世间万象.如ABC,如“一.二.三”. 字符集 字符集是所有字符的集合. XXX字符集 给字符集中的每一个字符套上一个序 ...
- Tuple
Tuple(组元)是C# 4.0引入的一个新特性,编写的时候需要基于.NET Framework 4.0或者更高版本. 在以前编程中,当需要返回多个值得方法中,常常需要将这些值放置到一个结构体或者对象 ...