Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
DB Engine
SQL ServerMSDESQL Server CE
Services
Analysis (Data Mining)Analysis (OLAP)DTSIntegration ServicesNotification ServicesReporting Services
Programming
CLRConnectivitySQLXML
Other Technologies
ClusteringEnglish QueryFull-Text SearchReplicationService Broker
General
Data WarehousingPerformanceSecuritySetupSQL Server ToolsOther SQL Server Topics
DirectoryUser Groups
Related Topics
MS AccessOther DB ProductsMS Server Products.NET DevelopmentVB DevelopmentJava DevelopmentMore Topics ...

SQL Server Forum / Services / Reporting Services / December 2006

Tip: Looking for answers? Try searching our database.

Need help with the Reportviewer in .NET

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Henrik Nordgren - 27 Dec 2006 23:24 GMT
Hi!

Im working with VS2005 and I have created a winforms application that uses
the reportviewer to show a report. I have a header with some text, a table
which I populate from a datasource, and an image which I also need to
populate from a datasource. The problem is that the image doesnt show, all I
get is a red X

I ahve found no example code anywhere on msdn that show how to display jpegs
from a database... So I have played with the code for about 2 days, and now I
give up. I have read all documentation regarding images from database that I
found on msdn.
---------------------------------------------------------
Here is some code:

_reportViewer.LocalReport.DataSources.Add(New
ReportDataSource("ReportData_Table", _bodyDs.Tables(0)))

       
       _reportViewer.LocalReport.DataSources.Add(New
ReportDataSource("ReportData_TablePicture", _pictureDs.Tables(0)))
----------------------------------------------------------

The _pictureDs.Tables(0) dataset contains one column called "BLOB" which
contains the jpeg picture. I have configured the image as follows:

MIMEType: image/jpeg
Source: Database
Value: =Fields!BLOB.Value

One thing puzzles me. I dont specify a datasource, as I do with the table
object, does the reportviewer search in both databases for a column called
BLOB? Or how is it supposed to work? Im very puzzled by this.

---------------------------------------------------------------------
Her eis some xml code from the report:

<Image Name="imgPAM">
       <Sizing>AutoSize</Sizing>
       <Left>8cm</Left>
       <MIMEType>image/gif</MIMEType>
       <Top>2.75cm</Top>
       <ZIndex>5</ZIndex>
       <Width>6.5cm</Width>
       <Source>Database</Source>
       <Style>
         <BorderStyle>
           <Default>Solid</Default>
         </BorderStyle>
       </Style>
       <Height>6.25cm</Height>
       <Value>=Fields!BLOB.Value</Value>
     </Image>

--------------------------------------------------------------------
The datasource section:
 <DataSets>
   <DataSet Name="ReportData_Table">
     <rd:DataSetInfo>
       <rd:DataSetName>ReportData</rd:DataSetName>
       <rd:TableName>Table</rd:TableName>
     </rd:DataSetInfo>
     <Query>
       <rd:UseGenericDesigner>true</rd:UseGenericDesigner>
       <CommandText />
       <DataSourceName>DummyDataSource</DataSourceName>
     </Query>
     <Fields>
       <Field Name="SITE_CODE">
         <rd:TypeName>System.String</rd:TypeName>
         <DataField>SITE_CODE</DataField>
       </Field>
       <Field Name="tool_part_no">
         <rd:TypeName>System.String</rd:TypeName>
         <DataField>tool_part_no</DataField>
       </Field>
       <Field Name="class">
         <rd:TypeName>System.String</rd:TypeName>
         <DataField>class</DataField>
       </Field>
       <Field Name="description">
         <rd:TypeName>System.String</rd:TypeName>
         <DataField>description</DataField>
       </Field>
       <Field Name="tool_unit_code_descr">
         <rd:TypeName>System.String</rd:TypeName>
         <DataField>tool_unit_code_descr</DataField>
       </Field>
       <Field Name="A">
         <rd:TypeName>System.String</rd:TypeName>
         <DataField>A</DataField>
       </Field>
       <Field Name="B">
         <rd:TypeName>System.String</rd:TypeName>
         <DataField>B</DataField>
       </Field>
     </Fields>
   </DataSet>
   <DataSet Name="ReportData_TablePicture">
     <rd:DataSetInfo>
       <rd:DataSetName>ReportData</rd:DataSetName>
       <rd:TableName>TablePicture</rd:TableName>
     </rd:DataSetInfo>
     <Query>
       <rd:UseGenericDesigner>true</rd:UseGenericDesigner>
       <CommandText />
       <DataSourceName>DummyDataSource</DataSourceName>
     </Query>
     <Fields>
       <Field Name="BLOB">
         <rd:TypeName>System.Byte</rd:TypeName>
         <DataField>BLOB</DataField>
       </Field>
     </Fields>
   </DataSet>
 </DataSets>
-----------------------------------------------------------------------

I need urgent help on this, I thought it was really simple to add a  picture
to a report... lolz!
/Henrik
Henrik Nordgren - 28 Dec 2006 10:25 GMT
Hi!

I solved the error (possible bug in the reportviewer???) by creating a table
instead where I added an image in a single column, and voíla it worked!!!

kind regards
Henrik

Signature

.NET Developer

> Hi!
>
[quoted text clipped - 117 lines]
> to a report... lolz!
> /Henrik
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.