How To Display Image From Access Database 2007 Although All Data Display in rdlc

Total Post:17

Points:119
C#  .NET  Reporting 
C#
 633  View(s)
Ratings:
Rate this:

I have problem in display image from access 2007 database to rdlc

i work in c# vs2015

Actually i need to display image from database to more records from access 2007

but i cannot

in rdlc i do as following :

In RDLC 

drag image control to
report source database
mime type jpeg
set EnableExternalImages = true
=First(Fields!qrimg.Value, "DataSetImage") for value
Name as Name of column in dataset .

In dataset 

qrimg system.Byte[]
on database qrimg image store datatypE OLEOBJECT
on interface 
in button click view report
reportViewer1.LocalReport.EnableExternalImages = true;

            QrClasses q = new QrClasses();

                DataSetImage printexcel = q.GetDataImage();

                ReportDataSource datasource = newReportDataSource("DataSetImage", printexcel.Tables[0]);

                this.reportViewer1.LocalReport.DataSources.Clear();

                this.reportViewer1.LocalReport.DataSources.Add(datasource);

                this.reportViewer1.RefreshReport();


using (OleDbConnection con = newOleDbConnection(connection))

            {

                using (OleDbCommand cmd = newOleDbCommand("SELECT UserID,UserNameAR,CountryAR,MemberAR,qrimg FROM AllPrinting"))

                {

                    using (OleDbDataAdapter sda = new OleDbDataAdapter())

                   {

                        cmd.Connection = con;

                        sda.SelectCommand = cmd;

                        using (DataSetImage dsimage = new DataSetImage())

                        {

                            sda.Fill(dsimage, "DataTable1");

                            return dsimage;

                        }
                    }
                }
            }
        }

Final result i can show all data from access 2007 in report but image cannot display

can any one help me please if possible

i do every thing but really cannot show image .


  1. Post:7

    Points:49
    Re: How To Display Image From Access Database 2007 Although All Data Display in rdlc

    To remove the OLE header from associate degree Access image

    1. Add a picture from associate degree Access information supply as represented within the previous procedure.

    2. within the Image Properties window, click the expression (fx) button.

    3. within the Expression window, copy the subsequent expression, with no line breaks, into the expression pane:

    =System.Convert.FromBase64String(Mid(System.Convert.ToBase64String(Fields!ImageFieldName.Value),105))

    The expression uses middle to exclude the header data, that resides within the initial a hundred and five characters of the file, then uses Convert to form the remainder of the image base64 encoded. The expression assumes that the image originates in associate degree EN-US information. If you're employing a completely different collation, the OLE header could be longer or shorter than a hundred and five characters.

    4. Click OK double.

    a picture placeholder seems on the report style surface.

    HR and Payroll Software  HR Software Malaysia | Free Payroll Software for Malaysia

      Modified On Apr-11-2018 10:23:38 PM

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!