Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
Hi
I want to dispaly image in Crystal Report From Folder Based on Imagepath from Database.
I am using Vb.net
Thank You
Posted 31-Jan-13 21:20pm
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Hi,
Put an image field in your report, then change the image’s Graphic Location:
right click the image, select Format Graphic, select Picture tab, click the conditional-formula button that look like a x2 and set the formula’s text to the name of the formula or parameter field that will contain the image’s URL.
Save the formula and click the OK button. Save the report and test it.
Be carefull with the size of the image field. If this size is not equal to the image itself it could get resized.
 
Googled from http://stackoverflow.com/questions/3170387/display-image-in-crystal-report-using-physical-path[^]
 
Best Regards,
VG
  Permalink  
v2
Comments
Agent_Spock at 1-Apr-14 0:38am
   
sir, can you provide image as i cant see image’s Graphic Location option.
VitorHugoGarcia at 1-Apr-14 6:24am
   
To change the image's graphic location follow these steps :
 
right click the image, select Format Graphic, select Picture tab, click the conditional-formula button that look like a x2 and set the formula’s text to the name of the formula or parameter field that will contain the image’s URL.
Save the formula and click the OK button. Save the report and test it.
VitorHugoGarcia at 1-Apr-14 6:36am
   
Here it is :
This is after you right click the image, select Format Graphic and select Picture tab
http://s4.postimg.org/eoa31sf19/Graphics_Location.jpg
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Don't use physical paths with CR directly. Store your image in a datatable or in a binary field of your database and show that.
 
Here is a code project solution that uses datatables:
 
Image in Crystal Reports
 
It's simple, C# and a little old, but I think you get the trick.
 
[Agent_Spock]
Removed unwanted code brackets
  Permalink  
v2
Comments
Member 9799439 at 2-Feb-13 0:27am
   
Thank you.but i am using crystal report 9 and in that insert picture object -> select format graphic -> then select picture tab.. here 'graphic location ' option not showing.
what to do now..?
Member 9799439 at 5-Feb-13 1:21am
   
Hey Hi VG
I executed the code that you mentioned above but the same did not get executed.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

str="select distinct code,designname from table1 left join table2 on table1.code=table2.code"
cmd = New SqlCommand(Str, sqlconn)
      adpt = New SqlDataAdapter(cmd)
      DataSetDesign = New DataSet
      DataSetDesign.Clear()
      adpt.Fill(DataSetDesign, "MYtable")
 

Create a new table "Pic"
Field : DSG_CODE,varchar(15)
        oImg,varbinary(MAX)
 

        Dim iCtr As Integer
            Dim cPict, cCat, cDesCode, SqlStr As String
 
            SqlStr = "Delete From pict"
 
            Dim cmdInsert As SqlCommand
            cmdInsert = New SqlCommand(SqlStr, sqlconn)
            cmdInsert.ExecuteNonQuery()
 
            For iCtr = 0 To DataSetDesign.Tables(0).Rows.Count - 1
                cCat = Trim(DataSetDesign.Tables(0).Rows(iCtr).Item("designname"))
                cDesCode = Trim(DataSetDesign.Tables(0).Rows(iCtr).Item("code"))
 
                'Path of Folder
                cPict = "y:\" + cCat + "\DM 3D " + cDesCode + ".JPG"
 
                    Dim oImg As Byte()
                    oImg = ReadImageFile(cPict)
                    SqlStr = "Insert Into pict(oImg, DSG_Code)values(@oImg , @DSG_Code)"
                    cmdInsert = New SqlCommand(SqlStr, sqlconn)
                    'cmdInsert(Sqlstr, sqlconn)
                    cmdInsert.Parameters.Add("@oImg", Data.SqlDbType.Binary).Value = oImg
                    cmdInsert.Parameters.Add("@DSG_CODE", Data.SqlDbType.VarChar).Value = cDesCode
                    cmdInsert.ExecuteNonQuery()
      Next
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 385
1 Sergey Alexandrovich Kryukov 329
2 CPallini 270
3 DamithSL 214
4 Maciej Los 192
0 OriginalGriff 5,515
1 DamithSL 4,451
2 Maciej Los 3,902
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,175


Advertise | Privacy | Mobile
Web03 | 2.8.141216.1 | Last Updated 1 Apr 2014
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100