tags:

views:

1563

answers:

3

Hi,

I need help.Well, i need add image logo in reportviewer dynamically.I get  this image from db, convert toBase64 and  i need add  in reportviewer.... this code next..

rpViewer.LocalReport.EnableExternalImages = true;

        Company _company = db.Companys.Where(c => c.codCompany == c.codCompany).Single();

        //first step
        byte[] img = _company.imagem.ToArray();   //  i get image from db
        MemoryStream _ms = new MemoryStream(img);

        string logo = Convert.ToBase64String(img); //convert to base64

        // 2 step  
        List<ReportParameter> lstReportParams = new List<ReportParameter>();//Create params
        lstReportParams.Add(new ReportParameter("Logo", logo));
        lstReportParams.Add(new ReportParameter("LogoMimeType", "image/png"));

        this.rpViewer.LocalReport.SetParameters(lstReportParams); // Here don´t  work´s

{"An error occurred during local report processing."} {"An attempt was made to set a report parameter 'Logo' that is not defined in this report."}

        this.rpViewer.RefreshReport();

       In Rldc....

MIMEType =Parameters!LogoMimeType.value Value ="System.Convert.FromBase64String(Parameters!Logo.Value)"

Why not work?

Why is not recognizing the parameter?

need help urgente.I can load that image in reportviewer...Thank´s..

A: 

The error message say's that you have not defined the report parameter Logo. Is this report parameter defined?

You may also be running into problems with the size of the parameters you are sending in.

We had a similar problem, with a report that needed to display different images. In our case there were only about 10 images.

The way we solved it was to place all images on the report, and then set them visable or not depending upon a parameter.

Shiraz Bhaiji
Hi,I need to just take a picture in db which is the company's logo and show it in report.This parameters in RLDC its ok?MIMEType =Parameters!LogoMimeType.value Value Value ="System.Convert.FromBase64String(Parameters!Logo.Value)"Thanks..
A: 

Your RDLC file needs to have the Logo parameter created in order for your Parameter List to be reckognized by your report.

You will need to edit your RDLC file, and create a parameter. You can do this by opening the RDLC file in Visual Studio, then click on Report in the file menu, and select Report Parameters.

Jon
A: 

how to convert this string to image in report viewer?

Raag

related questions