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. General Programming
  3. C#
  4. getting an Image from DataSet

getting an Image from DataSet

Scheduled Pinned Locked Moved C#
databasecomquestion
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.
  • S Offline
    S Offline
    Sasuko
    wrote on last edited by
    #1

    I've a database access with 1 OLE OBJECT field contained an Image. I've queried the database the result is in the DataSet. Now i would to get the image contained here: myDataSet.Tables[0].Rows[i]["Image"] how?

    G 1 Reply Last reply
    0
    • S Sasuko

      I've a database access with 1 OLE OBJECT field contained an Image. I've queried the database the result is in the DataSet. Now i would to get the image contained here: myDataSet.Tables[0].Rows[i]["Image"] how?

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

      You got it. Right there. What do you want to do with it? --- b { font-weight: normal; }

      S 1 Reply Last reply
      0
      • G Guffa

        You got it. Right there. What do you want to do with it? --- b { font-weight: normal; }

        S Offline
        S Offline
        Sasuko
        wrote on last edited by
        #3

        it doesn't work if i do: myImage = (Image)myDataSet.Tables[0].Rows[i]["Image"];

        S 1 Reply Last reply
        0
        • S Sasuko

          it doesn't work if i do: myImage = (Image)myDataSet.Tables[0].Rows[i]["Image"];

          S Offline
          S Offline
          S Akif Kamal
          wrote on last edited by
          #4

          You can read data from a DataSet simply by using the following code: byte[] _Image = (byte[])myDataSet.Tables[0].Rows[0]["Image"]; MemoryStream ms=new MemoryStream(_Image); Image image=Image.FromStream(ms); Now you have your image reconstructed if you have stored it as binary data. Akif

          S 1 Reply Last reply
          0
          • S S Akif Kamal

            You can read data from a DataSet simply by using the following code: byte[] _Image = (byte[])myDataSet.Tables[0].Rows[0]["Image"]; MemoryStream ms=new MemoryStream(_Image); Image image=Image.FromStream(ms); Now you have your image reconstructed if you have stored it as binary data. Akif

            S Offline
            S Offline
            Sasuko
            wrote on last edited by
            #5

            i've do it but i get error, maybe becouse i have set the image within Microsoft Access instead in my c#application. Could be it the cause? Just another question: if i set another kind of file as a word file or a .xls how can know what kind the file is it?

            S 1 Reply Last reply
            0
            • S Sasuko

              i've do it but i get error, maybe becouse i have set the image within Microsoft Access instead in my c#application. Could be it the cause? Just another question: if i set another kind of file as a word file or a .xls how can know what kind the file is it?

              S Offline
              S Offline
              S Akif Kamal
              wrote on last edited by
              #6

              I didnt get your point. Will you specify it in more details whats the problem Akif

              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