Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


Add image to crystal report based on dataset From network path not showing proplem why

Add image to crystal report based on dataset From network path not showing proplem why

Add image to crystal report based on dataset From network path not showing proplem why

I need to show image in crystal report based on employee No from network path

I Create


DataTable1 inside Dataset1 have these fields





and make stored procedure as

create proc ViewEmployeeNoR
@EmployeeNo nvarchar(20)

select * from dbo.ViewTest6 where DriverID=@EmployeeNo

and make Dataset1 as datasource of my report CrystalReportData1

and put in form crystal report viewer and textbox1 and button1

under button1 i write this code

DataTable dt = new DataTable();
string connString = "data source=; initial catalog=hrdata;uid=sa; password=1234";
using (SqlConnection con = new SqlConnection(connString))
SqlCommand cmd = new SqlCommand("ViewEmployeeNoR", con);
cmd.CommandType = CommandType.StoredProcedure; // Viewxxx doesn't seem a good name for a sp
cmd.Parameters.Add("@EmployeeNo", SqlDbType.NVarChar, 20);
cmd.Parameters["@EmployeeNo"].Value = textBox1.Text;
SqlDataAdapter da = new SqlDataAdapter();
da.SelectCommand = cmd;
dt.Columns.Add("Image", System.Type.GetType("System.Byte[]"));

string path = Path.Combine("\\\\\\Personal Pictures", textBox1.Text) + ".jpg";
FileStream fs=null;
if (File.Exists(path))
fs = new FileStream("\\\\\\Personal Pictures\\" + textBox1.Text + ".jpg", FileMode.Open);

MessageBox.Show("Please File Not Exist");


BinaryReader br = new BinaryReader(fs);
byte[] imgbyte = new byte[fs.Length + 1];
imgbyte = br.ReadBytes(Convert.ToInt32((fs.Length)));

foreach (DataRow dr in dt.Rows)
dr["Image"] = imgbyte;
ReportDocument objRpt = new Reports.CrystalReportData1();
crystalReportViewer1.ReportSource = objRpt;
Report work and show all data but image not show why
what is remaining
Path i tested it work but outside crystal report
can any one help me how to add image in crystal report from local path

RE: Add image to crystal report based on dataset From network path not showing proplem why

I am curious to know what type of field you used in the cr form ?

As far as I know there is nothing to show images dynamically in CR

RE: Add image to crystal report based on dataset From network path not showing proplem why

What version of Visual Studio are you using and what version of the crystal SDK?

I know that the SAP Crystal Reports for Visual Studio SDK (version 13.x) that is required for VS 2010 and newer has this capability, and I think the Crystal Reports 2008 SDK for VS 2008 does as well. I'm not sure about earlier versions.

All you need is some value from the database that will help you "build" the file name for the image. So, you would do the following:

1. Place an Picture object on your report - you'll need to point this to a "dummy" image that will be displayed if the image file doesn't exist.
2. Right-click on the object and select "Format Graphic...".
3. Go to the "Picture" tab.
4. Click on the formula button to the right of "Graphic Location:"
5. Enter a formula that provides the path to and file name of the image that you want to display.


DecisionFirst Technologies - Seven-time SAP BusinessObjects Solution Partner of the Year

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close