#1
  1. Contributing User
    ASP Discoverer (100 - 499 posts)

    Join Date
    Nov 2003
    Posts
    228
    Rep Power
    45

    Insert/Update Image in SQL Database


    I know it is not efficient to store images in a database but this is how my boss wants it done.
    How do i accomplish an insert and update of an image into a SQL database using classic ASP? Keep in mind that web server and the SQL server two different computers.
    Thanks in advance for you help.
    If I have been of useful help please don't hesitate to provide me with some Reputation points

    Be in Control of your Data and get it your way. Customized Web Applications.
  2. #2
  3. Contributing User
    ASP Skiller (1500 - 1999 posts)

    Join Date
    Aug 2008
    Location
    USA
    Posts
    1,590
    Rep Power
    343
    Hi,

    There are two ways to store the images in database ,
    1. store the binary image code into the db
    2. store the image path(image name ) .

    if your looking for storing image binary data into db then you need to write a code which will generate the binary data from your image and store it on db.

    Storing Binary Files Directly in the Database Using ASP.NET 2.0 - 4GuysFromRolla.com
    if you found this post is useful click Give Rep button (bottom side on this reply ) and agree

    Jquery Shake Effect ,
    Andriod KitKat


    Thank You,
    KiranK
  4. #3
  5. Contributing User
    ASP Skiller (1500 - 1999 posts)

    Join Date
    Mar 2005
    Location
    Columbus, OH
    Posts
    1,592
    Rep Power
    278
    SQL 2008 has field type image, just for store images.
    you need
    1. read image file into binary array
    2. open recordset
    3. add new record to recordset
    4. assign value to imageField in recordset something like rs("picture")=picVal
    5. update recordset - rs.Update and you are done
    but do not forget if you need to display image from database you need read image from database and binary write to response...
    GK
    __________________________________________________ _____
    if you found this post is useful click Give Rep button (bottom side on this reply ) and agree

Similar Threads

  1. upload image to access database
    By christianb85 in forum ASP Development
    Replies: 1
    Last Post: October 9th, 2012, 12:52 AM
  2. Image Resize Part II - resize image on the fly
    By Shadow Wizard in forum Code Bank
    Replies: 109
    Last Post: September 27th, 2012, 08:45 AM
  3. Update to SQL database not working
    By gns1497 in forum .NET Development
    Replies: 7
    Last Post: September 26th, 2012, 05:25 PM
  4. SQL Insert Attack / Please help!
    By BillythePoet in forum ASP Development
    Replies: 1
    Last Post: August 6th, 2010, 03:39 PM
  5. Insert ASP value into Javascript?
    By GeekGirl in forum HTML, JavaScript And CSS Help
    Replies: 12
    Last Post: July 5th, 2007, 08:37 PM

IMN logo majestic logo threadwatch logo seochat tools logo