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. Database & SysAdmin
  3. Database
  4. updating an IMAGE column

updating an IMAGE column

Scheduled Pinned Locked Moved Database
databasehelpquestionannouncement
2 Posts 2 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.
  • J Offline
    J Offline
    jszpila
    wrote on last edited by
    #1

    Hello everyone, Recently I've inherited the maintenance of an application who's database contains and image column. I've received a few requests to update a few records, but I've never worked with image-typed columns before, and unfortunately the source code for the application is unavailable to me. I have the files I need to update the table with on my local machine - what would be the best way to get them into the table? Thanks in advance for any help.

    ------------------- abort, retry, fail?

    M 1 Reply Last reply
    0
    • J jszpila

      Hello everyone, Recently I've inherited the maintenance of an application who's database contains and image column. I've received a few requests to update a few records, but I've never worked with image-typed columns before, and unfortunately the source code for the application is unavailable to me. I have the files I need to update the table with on my local machine - what would be the best way to get them into the table? Thanks in advance for any help.

      ------------------- abort, retry, fail?

      M Offline
      M Offline
      Michael Potter
      wrote on last edited by
      #2

      Here is a small snippet of code from a C# bitmap helper library I use. I don't know of a way to handle this in SQL itself - I have always used an application to update image columns. _bm is a private Bitmap member variable. I use a stored proc to handle the update. I assign the returned byte array (returned as object) to the image parameter.

      public object Save()
      {
          if (_bm == null)
          {
              return DBNull.Value;
          }
          else
          {
              MemoryStream ms = new MemoryStream();
              _bm.Save(ms,_bm.RawFormat);
              byte[] buf = ms.GetBuffer();
              ms.Close();
              return buf;
          }
      }
      
      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