Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Parameter not valid

Parameter not valid

Scheduled Pinned Locked Moved ASP.NET
graphicshelp
6 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    Viral Upadhyay
    wrote on last edited by
    #1

    HI, I am fecthing varbinary data from data base and converting it to Image data. i got error of 'Parameter is not valid' i use this code System.Drawing.Image img; byte[] photobyte = (byte[])dtPhoto.Rows[0][0]; using (MemoryStream stream = new MemoryStream((byte[])dtPhoto.Rows[0][0])) { img = System.Drawing.Image.FromStream(stream); // here i gor error img.Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.Jpeg); } Thanks

    Viral YahooID : just_viral My Site : www.theseoworld.info

    K G 2 Replies Last reply
    0
    • V Viral Upadhyay

      HI, I am fecthing varbinary data from data base and converting it to Image data. i got error of 'Parameter is not valid' i use this code System.Drawing.Image img; byte[] photobyte = (byte[])dtPhoto.Rows[0][0]; using (MemoryStream stream = new MemoryStream((byte[])dtPhoto.Rows[0][0])) { img = System.Drawing.Image.FromStream(stream); // here i gor error img.Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.Jpeg); } Thanks

      Viral YahooID : just_viral My Site : www.theseoworld.info

      K Offline
      K Offline
      kubben
      wrote on last edited by
      #2

      Why are you using Response.OutputStream instead of the stream var you just created? Ben

      V 1 Reply Last reply
      0
      • K kubben

        Why are you using Response.OutputStream instead of the stream var you just created? Ben

        V Offline
        V Offline
        Viral Upadhyay
        wrote on last edited by
        #3

        Hi ben i use Response.OutputStream for display image on Page. thanks for reply...

        Viral YahooID : just_viral My Site : www.theseoworld.info

        1 Reply Last reply
        0
        • V Viral Upadhyay

          HI, I am fecthing varbinary data from data base and converting it to Image data. i got error of 'Parameter is not valid' i use this code System.Drawing.Image img; byte[] photobyte = (byte[])dtPhoto.Rows[0][0]; using (MemoryStream stream = new MemoryStream((byte[])dtPhoto.Rows[0][0])) { img = System.Drawing.Image.FromStream(stream); // here i gor error img.Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.Jpeg); } Thanks

          Viral YahooID : just_viral My Site : www.theseoworld.info

          G Offline
          G Offline
          Guffa
          wrote on last edited by
          #4

          Are you trying to change the file format of the image, or why are you loading and saving the image? If you just want to send the image to the browser, don't use any Image object, just send the bytes.

          --- single minded; short sighted; long gone;

          V 1 Reply Last reply
          0
          • G Guffa

            Are you trying to change the file format of the image, or why are you loading and saving the image? If you just want to send the image to the browser, don't use any Image object, just send the bytes.

            --- single minded; short sighted; long gone;

            V Offline
            V Offline
            Viral Upadhyay
            wrote on last edited by
            #5

            Well i try it too but dont work can please tell me how to send the byte?? thanks for your reply..

            Viral YahooID : just_viral My Site : www.theseoworld.info

            G 1 Reply Last reply
            0
            • V Viral Upadhyay

              Well i try it too but dont work can please tell me how to send the byte?? thanks for your reply..

              Viral YahooID : just_viral My Site : www.theseoworld.info

              G Offline
              G Offline
              Guffa
              wrote on last edited by
              #6

              Use the Response.BinaryWrite method.

              --- single minded; short sighted; long gone;

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups