Hi
How to store and retrieve images in SQL server database through VB.NET ?
Store and Retrieve Images in SQL Server Database through VB.NET
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Mayur GujrathiRank #666 · 3.6K reputationPosted Jun 21, 2012, 5:03 AM EDT
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
Satyapriya NayakRank #47 · 31.5K reputationPosted Jun 21, 2012, 5:34 AM EDT
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