Hi
How to store and retrieve images in SQL server database through VB.NET ?
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Satyapriya NayakPosted Jun 21, 2012, 9:34 AM
Please refer the below links
http://www.c-sharpcorner.com/UploadFile/satyapriyanayak/add-details-of-an-employee-with-image-and-display-it-into-a/
http://www.c-sharpcorner.com/UploadFile/satyapriyanayak/how-to-save-image-along-with-details-into-database-in-asp-ne/
Thanks
Mayur GujrathiPosted Jun 21, 2012, 9:03 AM
string finalpath = null;
finalpath = Server.MapPath(destpath);
FileStream fs = new FileStream(finalpath, System.IO.FileMode.Open, System.IO.FileAccess.Read);
Imag = new byte[fs.Length];
fs.Read(Imag, 0, Convert.ToInt32(fs.Length));
fs.Close();
And then store Imag variable in sql server database
Its datatype should be varbinary in sql table