none
Database image does not show in a report VS2008 RRS feed

  • Question

  • Hi all
    I m trying to display esignature image in my report. I spend a whole day, and it will just not show.
    I insert the image into a database using Linq and are able to retrieve it and show it in a pictureBox in windows Forms.
    I does not seem to work in a report Image control.

    This works like a charm in Windows Forms:

     //insert
    Bitmap bitMap =
    new Bitmap(openFileDialog1.FileName);
    MemoryStream ms = new MemoryStream();
    bitMap.Save(ms, ImageFormat.Jpeg);
    byte[] imageByteArray = ms.ToArray();
    Binary binary =
    new Binary(imageByteArray);
    var query = Queries.images(db, int.Parse(textBox1.Text));
    foreach (var q in query)
    {
    q.ESignatureBLOB = binary;
    }
    db.SubmitChanges();

    //retrieve
    byte
    [] buffer = Queries.images(db, int.Parse(textBox1.Text)).SingleOrDefault().ESignatureBLOB.ToArray();
    ms =
    new MemoryStream(buffer);
    pictureBox1.Image = Image.FromStream(ms);


    But the image will not show in a report.
    I tried to convert it to a byte[] doesnt show.
    I tried  Convert.ToBase64String and Convert.FromBase64String no go

    Any suggestions greatly appreciated
    thanks

    Friday, August 8, 2008 12:36 PM

Answers

All replies

  • Usually, I find it's helpful to simplify things when I have problems.   Can you get your name to show up as a signature in simple text. Skip the image concept for now.  Can you just send a simple piece of text in as your sig?  If you can do this, you've done most of the work.
    Living my life at 123mph in 11.15 seconds
    Friday, August 8, 2008 1:22 PM
  •  I can get all the fields from the database except the image t.ESignatureBLOB which is System.Data.Linq.Binary
    this is what I tried

    //I retrieve the data
    var TimesheetReport = Utilities.TimesheetReportQuery(db, TimeAndEffort.Properties.Settings.Default.RecordID, TimeAndEffort.Properties.Settings.Default.selectedValue);


    //all these I tried and none of the fields below show as an image in the report
    foreach
    (var t in TimesheetReport)
    {
    t.ESignatureImage = ConvertToImage(t.ESignatureBLOB.ToArray());

    t.ESignatureString = Convert.ToBase64String(t.ESignatureBLOB.ToArray());

    t.ESignatureByte = (t.ESignatureBLOB.ToArray());

    t.ESignatureBitmap = ConvertToBitmap(t.ESignatureBLOB.ToArray());


    }
    timesheetbindingSource.DataSource = TimesheetReport;
    this.reportViewer.RefreshReport();
    //then I bind the bindingsource to the report

    All my fields values show on the report except the  ones that come from t.ESignatureBLOB above

    Friday, August 8, 2008 2:53 PM
  • I found the problem. The report does not seem to like System.Data.Linq.Binary I replaced Binary in  all my classes with byte[] and the images pop up on the report
    Friday, August 8, 2008 3:56 PM