How to save image in database
Data base design:
- Create SQL table with the name of
"ImageExample" and the create column with image datatype as Image.

Store Image in Grid:
To store image in database first we have to open and read the file and convert
the file into byte array. For saving to database
The C# coding to save image:
SqlConnection
con = new
SqlConnection("Connection string");
con.Open();
SqlCommand
oc=new SqlCommand("insert
into TableName values(@Image)",con);
string
path=@"Path\imagename.JPG";
FileStream fs=new
FileStream(path,FileMode.Open,FileAccess.Read);
BinaryReader
br=new BinaryReader(fs);
FileInfo fi=new
FileInfo(path);
byte[] imagedata
= br.ReadBytes((int)fi.Length);
oc.Parameters.Add("@Image",
imagedata);
oc.ExecuteNonQuery();
con.Close();
Retrieve image from database using handler.
- Right click on solution explorer and select add new item.In that select hanler.ashx and rename as ImageHandler.ashx

eswar raoPosted Jan 25, 2015, 10:06 AM
filestream not recognize....
surender bhyanPosted Sep 1, 2011, 6:14 AM
Thanks a lot sir..i am just searching for the same. :-)
SujithaPosted Aug 18, 2011, 4:42 AM
nice article its very useful thank u
Rohatash KumarPosted Aug 16, 2011, 8:04 AM
Good article for beginners. thanks
Dea SaddlerPosted Aug 16, 2011, 6:34 AM
Good Article