I'm using MSSQL Server.
Main Topics
Browse All TopicsHey!
I have a binary field in my database. I want to display it via the new ReportViewer control (Visual Studio 2005).
I read this link: http://msdn2.microsoft.com
Where It's saying:
Using an External or Database Image to a Report
To use a database image, you can specify the database field that contains the image as long as the MIME type is JPG, PNG, or BMP. If the image is stored as a binary object, you must write an expression that converts the image to a supported type.
What's the expression that converts the image?
[melack]
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Nothing special is needed, assuming you are storing an SQLServer image datatype.
==========================
The following Report1.rdlc, for example, assuming a table with id (integer) and picture (image, with bmps stored), gives a list matching the id to the picture:
<?xml version="1.0" encoding="utf-8"?>
<Report xmlns="http://schemas.micr
<DataSources>
<DataSource Name="jbftestConnectionStr
<ConnectionProperties>
<ConnectString>Data Source=JBFIEDERERXP\;Initi
<DataProvider>SQL</DataPro
</ConnectionProperties>
<rd:DataSourceID>b85aa84d-
</DataSource>
</DataSources>
<BottomMargin>1in</BottomM
<RightMargin>1in</RightMar
<rd:DrawGrid>true</rd:Draw
<InteractiveWidth>8.5in</I
<rd:SnapToGrid>true</rd:Sn
<Body>
<ReportItems>
<List Name="list1">
<Left>0.625in</Left>
<ReportItems>
<Image Name="image1">
<Sizing>AutoSize</Sizing>
<Left>1.875in</Left>
<Top>0.125in</Top>
<ZIndex>1</ZIndex>
<Width>1.5in</Width>
<Source>Database</Source>
<Style />
<Height>0.75in</Height>
<MIMEType>image/bmp</MIMET
<Value>=Fields!picture.Val
</Image>
<Textbox Name="id">
<Left>0.125in</Left>
<Top>0.125in</Top>
<rd:DefaultName>id</rd:Def
<Width>1in</Width>
<Style>
<TextAlign>Right</TextAlig
<PaddingLeft>2pt</PaddingL
<PaddingBottom>2pt</Paddin
<PaddingRight>2pt</Padding
<PaddingTop>2pt</PaddingTo
</Style>
<CanGrow>true</CanGrow>
<Height>0.25in</Height>
<Value>=Fields!id.Value</V
</Textbox>
</ReportItems>
<DataSetName>jbftestDataSe
<Top>0.5in</Top>
<Width>5.375in</Width>
<Height>1in</Height>
</List>
</ReportItems>
<Height>6in</Height>
</Body>
<rd:ReportID>5d1e74f0-6e0b
<LeftMargin>1in</LeftMargi
<DataSets>
<DataSet Name="jbftestDataSet_tab1"
<rd:DataSetInfo>
<rd:TableAdapterGetDataMet
<rd:DataSetName>jbftestDat
<rd:TableAdapterFillMethod
<rd:TableAdapterName>tab1T
<rd:TableName>tab1</rd:Tab
</rd:DataSetInfo>
<Query>
<rd:UseGenericDesigner>tru
<CommandText>SELECT id, picture FROM dbo.tab1</CommandText>
<DataSourceName>jbftestCon
</Query>
<Fields>
<Field Name="id">
<rd:TypeName>System.Int32<
<DataField>id</DataField>
</Field>
<Field Name="picture">
<rd:TypeName>System.Byte[]
<DataField>picture</DataFi
</Field>
</Fields>
</DataSet>
</DataSets>
<Width>6.5in</Width>
<InteractiveHeight>11in</I
<Language>en-US</Language>
<TopMargin>1in</TopMargin>
</Report>
==========================
However, for the life of me I cannot figure out how to set the MIMEtype from the designer. If it is NOT set, the report will not compile. I had to insert it by editing the XML.
Sure. If you design your dataset with a parameter in the sql
(My dataset with just one datatable had
SELECT code, text, code2
FROM codetext
WHERE (code2 = @codeval)
as SQL
)
then your Fill method will get an extra parameter, in which you can put the parameter value
private void button1_Click(object sender, EventArgs e)
{
int codeval = int.Parse(textBox1.Text);
this.codetextTableAdapter.
this.reportViewer1.Refresh
}
Business Accounts
Answer for Membership
by: jensfiedererPosted on 2006-01-20 at 05:48:37ID: 15748671
That depends on the database you are using. They are saying that your SQL cannot just pass off a blob, it needs to convert the blob to something like a string. Which database?