Solved

Insert image in Crystal Reports At Runtime

Posted on 2010-08-12
3
363 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
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Close word object 13 38
Class object 2 26
Replace &lt; with < 14 55
Capture logon name 11 31
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…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

912 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now