Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post May 04, 2012 04:02 AM by teguhyuliantos
Apr 24, 2012 01:48 PM|LINK
i want to save image in db which datatype should i use(image or binary)?the best one.i also need a code example(i dont find good code).
remmeber i dont want to save address of image i just want to save image in DB.
Apr 24, 2012 01:53 PM|LINK
Image works fine for me :)
Apr 24, 2012 02:23 PM|LINK
Apr 24, 2012 04:18 PM|LINK
I use VARBINARY(MAX), it works fine. The UPDATE TABLE code is:
SET TargetImage = (SELECT * FROM OPENROWSET(BULK N'your image path on server', SINGLE_BLOB) AS TargetImage)
Apr 24, 2012 04:32 PM|LINK
I will prefer you to store address of image in DB but if you don't want to store address of image file in DB then you can use image datatype.
See following URL for example:
Hope this will solve your problem.
Apr 26, 2012 01:36 AM|LINK
should i use(image or binary)?
In SQL field，I think you can use image type，For C#，use byte group——byte。
You can use File.ReadAllBytes to read out the whole byte group collection and set assignment to db。
Here's an example you can refer made by me to use GridView+DetailsView+Httphandler to insert a whole img into db：
Apr 26, 2012 01:43 AM|LINK
refer this link
May 04, 2012 04:02 AM|LINK
To save the images in db asp, please refer the link below, maybe your problem can solve.