Notices

Great community. Great ideas.

Welcome to ASP/Free, a community dedicated to helping beginners and professionals alike in improving their knowledge of Microsoft's development and administration technologies. Sign up today to gain access to the combined insight of tens of thousands of members.

Thread: Insert/Update Image in SQL Database

Results 1 to 3 of 3
Share This Thread →
  1. #1
    moracom's Avatar
    moracom is offline Contributing User
    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
    markWilson's Avatar
    markWilson is offline Contributing User
    Join Date
    Aug 2008
    Posts
    1,556
    Rep Power
    342
    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

    Andriod KitKat
    Jquery Shake Effect ,

    Thank You,
    KiranK

  3. #3
    gk53's Avatar
    gk53 is offline Contributing User
    Join Date
    Mar 2005
    Location
    Columbus, OH
    Posts
    1,535
    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

Share This Thread →

Become Part of This Conversation

Join NowFor Free!

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

ASP Free Advertisers and Affiliates