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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. Extracting image from d/b & displaying it in a cell of a table

Extracting image from d/b & displaying it in a cell of a table

Scheduled Pinned Locked Moved ASP.NET
databasegraphicsdesignhelpquestion
5 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.
  • N Offline
    N Offline
    neha12
    wrote on last edited by
    #1

    In this way Iam extracting an image from the database-: Dim s As Image Dim arrPicture() As Byte = CType(reader1.GetValue(2), Byte()) Dim ms As New MemoryStream(arrPicture) s.FromStream(ms) Now I want to transfer this image in a specific cell of a table.So I use the statement as given below -: “tcell.Controls.Add(s)” But then this statement is giving me error stating that -: “Value of type “system.drawing.image” cannot be converted to “system.web.ui.control” “ Is there a way so that I can convert “system.drawing.image” to “system.web.ui.control” ???

    J N 2 Replies Last reply
    0
    • N neha12

      In this way Iam extracting an image from the database-: Dim s As Image Dim arrPicture() As Byte = CType(reader1.GetValue(2), Byte()) Dim ms As New MemoryStream(arrPicture) s.FromStream(ms) Now I want to transfer this image in a specific cell of a table.So I use the statement as given below -: “tcell.Controls.Add(s)” But then this statement is giving me error stating that -: “Value of type “system.drawing.image” cannot be converted to “system.web.ui.control” “ Is there a way so that I can convert “system.drawing.image” to “system.web.ui.control” ???

      J Offline
      J Offline
      John Kuhn
      wrote on last edited by
      #2

      Could you write the image to a temporary file, then add a literal control with the IMG tag referencing the temporary file, or something along those lines? What a piece of work is man, how noble in reason, how infinite in faculties, in form and moving how express and admirable . . . and yet to me, what is this quintessence of dust? -- Hamlet, Act II, Scene ii.

      N 1 Reply Last reply
      0
      • J John Kuhn

        Could you write the image to a temporary file, then add a literal control with the IMG tag referencing the temporary file, or something along those lines? What a piece of work is man, how noble in reason, how infinite in faculties, in form and moving how express and admirable . . . and yet to me, what is this quintessence of dust? -- Hamlet, Act II, Scene ii.

        N Offline
        N Offline
        neha12
        wrote on last edited by
        #3

        Any other way u can think of ... I am already using this technique , but could u please tell me anyother way out ? Thanks for replying,

        J 1 Reply Last reply
        0
        • N neha12

          Any other way u can think of ... I am already using this technique , but could u please tell me anyother way out ? Thanks for replying,

          J Offline
          J Offline
          John Kuhn
          wrote on last edited by
          #4

          I think that it is not possible to cast System.Drawing.Image to System.Web.UI.WebControls.Image. There is a way to send bytes to the browser, using HttpResponse.BinaryWrite, but I'm not familiar enough with it to show you any code. What a piece of work is man, how noble in reason, how infinite in faculties, in form and moving how express and admirable . . . and yet to me, what is this quintessence of dust? -- Hamlet, Act II, Scene ii.

          1 Reply Last reply
          0
          • N neha12

            In this way Iam extracting an image from the database-: Dim s As Image Dim arrPicture() As Byte = CType(reader1.GetValue(2), Byte()) Dim ms As New MemoryStream(arrPicture) s.FromStream(ms) Now I want to transfer this image in a specific cell of a table.So I use the statement as given below -: “tcell.Controls.Add(s)” But then this statement is giving me error stating that -: “Value of type “system.drawing.image” cannot be converted to “system.web.ui.control” “ Is there a way so that I can convert “system.drawing.image” to “system.web.ui.control” ???

            N Offline
            N Offline
            Not Active
            wrote on last edited by
            #5

            This subject has been covered more than once. Search.

            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