Solved

Insert image in Crystal Reports At Runtime

Posted on 2010-08-12
3
367 Views
Last Modified: 2013-12-27
Ok I am trying to bring a image out of my database and associate it with each product line item.

Ive read the example at  http://www.codeproject.com/KB/vb/Image_in_Crystal_Reports.aspx

but that didnt seem to help, any ideas? thanks


Sales.Logic.SalesOrderCollection orders = new Sales.Logic.SalesOrderCollection();
                SalesOrderReport report = new SalesOrderReport();
                DataTable dt = new DataTable();
                dt = orders.GetOrderItems(ID).Tables[0];
                dt.Columns.Add("Image", System.Type.GetType("System.Byte[]"));

                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    Product.Logic.ProductMediaCollection medias = new Product.Logic.ProductMediaCollection();
                    medias.LoadByProductID(int.Parse(dt.Rows[i]["ProductID"].ToString()));

                    if(medias.Count > 0)
                        dt.Rows[i]["Image"] = (byte[])medias[0].Media;

                }

                report.SetDataSource(dt);
                crystalReportViewer.ReportSource = report;

Open in new window

0
Comment
Question by:Poolcorp
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 11

Accepted Solution

by:
mattibutt earned 500 total points
ID: 33425126
0
 
LVL 3

Author Comment

by:Poolcorp
ID: 33431071
No luck im afraid the same results. I am storing the image file in my sql server database as a "image" data type, could that have anything to do with it?
0
 
LVL 3

Expert Comment

by:farwa
ID: 33998755
trying storing it in bytes...
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you are anything like me, you install many apps on your phone and have your life on it, sometimes literally.  When I bought my current phone, a Samsung Galaxy S5 from Verizon, they were only selling the versions with 16 GB internal.  I didn't rea…
Let me explain this picture a little bit.  First, in case you haven't already guessed, you are looking at my 2 phones, an Android Samsung Galaxy S5 on the left and an iPhone 5 on the right.  They are on their respective cradles on my desk.  But, you…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question