locked
Image field not display images from database although i drag and put it in crystalreport ? RRS feed

  • Question

  • Problem

    Image field not display images from database although i drag and put it in crystalreport ?

    I have table Members Have Two fields MemberCode and MemberImage

    when make database expert and select database then select Members table

    and then drag membercode and MemberImage

    after run crystal report membercode display but MemberImage show empty

    so that how to display MmeberImage picture from database on crystal report ?

    memberimage field has datataype varbinary(max) and datatable that pass data to crystal report as following

    public DataTable GetChecked()
            {
                
                DataTable table = new DataTable();
                table.Columns.Add("MemberCode", typeof(string));
                table.Columns.Add("MemberImage", typeof(Byte[])); 
                
    
    
    
    
    
    
    
                for (int i = 0; i < dtDisplayDataPayment.Rows.Count; i++)
                {
    
                    
                        DataRow newRow = table.NewRow();
                        newRow["MemberCode"] = Utilities.ObjectConverter.ConvertToString(dtDisplayDataPayment.Rows[i]["MemberCode"]);
        
    
                       
                            if (dtDisplayDataPayment.Rows[i]["MemberImage"] != System.DBNull.Value)
                            {
                                byte[] photo_aray = (byte[])dtDisplayDataPayment.Rows[i]["MemberImage"];
                                System.Drawing.ImageConverter converter = new System.Drawing.ImageConverter();
                                Image img = (Image)converter.ConvertFrom(photo_aray);
                                newRow["MemberImage"] = imageToByteArray(img);
                            
                            
    
                           }
                        
    
                        
                        table.Rows.Add(newRow);
                    
                }
    
                return table;
    
    
            }
    so that how to display this image on crystal report please ?

    Thursday, February 7, 2019 2:28 AM

Answers

  • I convert image to byte and it work on crystal report

    thank you very much

    Saturday, February 9, 2019 10:06 AM