0

How to save an image from Image Control to SQL Server? I am not uploading that image, but i'm capturing it through webcam and displaying it on image control.

Ravindra
  • 21
  • 3
  • http://stackoverflow.com/questions/15659835/how-to-store-image-in-sql-server-database-tables-column check this – Anuj May 08 '13 at 11:34

1 Answers1

0

Supposing you need to save the image itself, and not the path, you could do:

FileStream fs = new FileStream(fileName, FileMode.Open, FileAccess.Read);

BinaryReader br = new BinaryReader(fs);

byte[] image = br.ReadBytes((int)fs.Length);

And then, send the bytes to your database.