October 10th, 2012, 03:25 PM
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.
October 12th, 2012, 03:56 AM
October 12th, 2012, 08:44 AM
SQL 2008 has field type image, just for store images.
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...
if you found this post is useful click Give Rep button (bottom side on this reply ) and agree