Announcement

Collapse
No announcement yet.

Image.FromStream(ms)----> error "Parameter is not valid

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Image.FromStream(ms)----> error "Parameter is not valid

    Hello!
    I have an OLE Object in my table, that may be jpg, doc, xml file.
    In case of jpg I'd like to show it (VS2005 Visual basic).
    I did next (not full code):

    Dim ms AsNew MemoryStream()
    Dim reader As OleDbDataReader = cmd.ExecuteReader(CommandBehavior.SequentialAccess )
    reader.Read()
    retval = reader.GetBytes(0, 0, outbyte, 0, bufferSize)
    ms.Write(outbyte, 0, retval)
    ms.Seek(0, SeekOrigin.Begin)
    curImage = Image.FromStream(ms)----> error "Parameter is not valid."

    I do not see the fault. Please help

  • #2
    Hi,

    I have an OLE Object in my table...
    the problem ist the OLE -Header. Save the stream to a DAT-file. View the DAT-file file with a Hex/ASCII viewer. Note several lines of header information followed by what appears to be the file-content. To get the orginal file-content, you must remove the OLE header.

    Comment


    • #3
      Thank You so much, excuse for delay (I did not get an remark from site).

      You were the 1st person, that did not tell it's simple and it must work.

      The problem is to discover the correct header length, i tried already a couple of times, but i didn't succeseeded

      Comment

      Working...
      X