I have a collection which contain images. I want to show those images on my RDLC report. Can anyone show me how to do that?
Please give me code or example.
rdlcreporting-services
I have a collection which contain images. I want to show those images on my RDLC report. Can anyone show me how to do that?
Please give me code or example.
From my experience there are few things to think about both things:
I. RDL reports are HOSTED reports generally. This means you need to implement SSRS Server. They are a built in extension of Visual Studio from SQL Server for the reporting language. When you install SSRS you should have an add on called 'Business Intelligence Development Studio' which is much easier to work with the reports than without it.
R eport
D efinition
L angauge
Benefits of RDL reports:
Downsides:
II. RDLC reports are CLIENT CONTAINED reports that are NOT HOSTED ANYWHERE. The extra c in the name means 'Client'. Generally this is an extension of the RDL language meant for use only in Visual Studio Client Applications. It exists in Visual Studio when you add a 'reporting' item.
Benefits of RDLC reports:
Downsides:
Honestly I like both for different purposes. If I want something to go out to analysts that they use all the time and tweak for graphs, charts, drill downs and exports to Excel I use RDL and just have SSRS's site do all the legwork of handling the email distributions. If I want an application that has a report section and I know that application is it's own module with rules and governance I use an RDLC and having the parameters be smaller and be driven by the decisions the user made before getting to the report part of what client they are on and site and then they usually just choose a time frame or type and nothing more. So generally a complex report I would use RDL and for something simple I would use RDLC IMHO.
I hope that helps.
The datasource for an RDLC report can be anything that implements IEnumerable
. If it is an enumeration of objects, then the properties on the object become fields in the report.
The thing about reports is they have their own internal notion of what the dataset is. At design time you need to provide the report designer with a dataset to work with. The report ingests that dataset internally and it is used to design the report. The reality is the report itself doesn't care about the actual dataset. It only cares about its schema. However, at runtime the objects you provide to satisfy that dataset can come from anywhere, as long as they satisfy that same schema.
I have a little blog post from back in my MS days that shows a trick on how to get good design time support, and then at runtime provide the report with any data you want:
http://blogs.msdn.com/b/magreer/archive/2008/10/16/setting-the-datasource-for-a-report-at-runtime.aspx
update Microsoft has since deleted my blog, but I found it in the wayback machine
Best Answer
If you want to retrieve an image from a table in a database and use it in a Reporting Services report all you have to do is create a data source that contains a field with the image and use it as data source of the image field, like you do with the rest of the data you show on the report.
Imagine you have a table named image_table with a column named image_col.
All you have to do is create a data source with a select sentence like:
Once you have the data source you assign it to the image field DataSource property and assign the Fields!image_col to the Value property of the image field. With this you have the image on the report.
To test the idea you can follow this steps:
1) Define a strong typed DataSet with a table name "image_table"
2) The image_table will have 2 columns IdCol (a numeric column) and image_col a (Byte() column)
3) Fill a dataset with data using something like this:
This will fill the dataset myDataSet with all the images in the table image_table.