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. How to add image to sql server database ?

How to add image to sql server database ?

Scheduled Pinned Locked Moved Database
databasequestioncsharpsql-servergraphics
5 Posts 4 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.
  • L Offline
    L Offline
    Lost User
    wrote on last edited by
    #1

    I'm new in the database world... I want to know if its possible to add image ( simple bitmap or jpeg ) to the database ? If this is possible => how can i get and set the image from C# code ? Thanks for the help.

    T R 2 Replies Last reply
    0
    • L Lost User

      I'm new in the database world... I want to know if its possible to add image ( simple bitmap or jpeg ) to the database ? If this is possible => how can i get and set the image from C# code ? Thanks for the help.

      T Offline
      T Offline
      Tony Pottier
      wrote on last edited by
      #2

      Hi, There is an "image" data type in SQL Server which is basically a binary datatype. http://msdn.microsoft.com/en-us/library/ms187993.aspx[^] Storing binary inside a database is generally strongly advised against though. Before you do that you might want to check if using the filesystem could be a better solution.

      R J 2 Replies Last reply
      0
      • T Tony Pottier

        Hi, There is an "image" data type in SQL Server which is basically a binary datatype. http://msdn.microsoft.com/en-us/library/ms187993.aspx[^] Storing binary inside a database is generally strongly advised against though. Before you do that you might want to check if using the filesystem could be a better solution.

        R Offline
        R Offline
        RaviRanjanKr
        wrote on last edited by
        #3

        Yes you can insert image or retrieve it from your Database by using BLOB(binary Large object) approach in which an image file is convert into Binary data which is compatible to store data in Database. Google has a lots of resource for this purpose. whatever i suggest you to move for this given link Save An Image Into SQL Server 2000 Database[^]

        1 Reply Last reply
        0
        • T Tony Pottier

          Hi, There is an "image" data type in SQL Server which is basically a binary datatype. http://msdn.microsoft.com/en-us/library/ms187993.aspx[^] Storing binary inside a database is generally strongly advised against though. Before you do that you might want to check if using the filesystem could be a better solution.

          J Offline
          J Offline
          Jorgen Andersson
          wrote on last edited by
          #4

          Tony Pottier wrote:

          Storing binary inside a database is generally strongly advised against though

          I disagree on the "generally strongly" advice. Manageability, consistency, security, reliability, portability are all reasons for storing binaries in the database. Storing binaries in the database means that you have db-enforced referential integrity, one point of entry for the backup, one place to set security...

          "When did ignorance become a point of view" - Dilbert

          1 Reply Last reply
          0
          • L Lost User

            I'm new in the database world... I want to know if its possible to add image ( simple bitmap or jpeg ) to the database ? If this is possible => how can i get and set the image from C# code ? Thanks for the help.

            R Offline
            R Offline
            RaviRanjanKr
            wrote on last edited by
            #5

            you can also download the given sample code to learn how to store and retrieve image from SQL server. Click on the given link to Download Click me[^]

            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