Check out this article:
Save and retrieve images from a database using ASP.NET 2.0 and ASP.NET 3.5
Example from the above article
First of all, you need to convert the image to bytes as follows:
FileUpload img = (FileUpload)imgUpload;
Byte[] imgByte = null;
if (img.HasFile && img.PostedFile != null)
{
HttpPostedFile File = imgUpload.PostedFile;
imgByte = new Byte[File.ContentLength];
File.InputStream.Read(imgByte, 0, File.ContentLength);
}
Then you add imgByteas the value when adding to your database.
source
share