I am try to convert image in byte then insert it into Database using C#.Below is my code .........
public byte[] getImageData(string strFleNm)
{
byte[] ImgData = null;
FileInfo fileinfo = new FileInfo(strFleNm);
long imagefilelenght = strFleNm.Length;
FileStream Fs = new FileStream(strFleNm, FileMode.Open, FileAccess.Read);
BinaryReader Br = new BinaryReader(Fs);
ImgData = Br.ReadBytes((int)imagefilelenght);
return ImgData;
}
but its give error,Error is like Could not find image .....................

Iftikar HussainRank #423 · 5.9K reputationPosted Jul 4, 2013, 10:41 PM EDT
Are you trying to store the image or just image file in DB?
Regards,
Iftikar
Sanjeeb LenkaRank #301 · 8.3K reputationPosted Jul 4, 2013, 10:51 PM EDT
http://www.c-sharpcorner.com/uploadfile/gowth/save-and-retrieve-image-from-sql-2005-in-Asp-Net/
if any doubt plz share your full cs code
Iftikar HussainRank #423 · 5.9K reputationPosted Jul 4, 2013, 11:03 PM EDT
Regards,
Iftikar
Iftikar HussainRank #423 · 5.9K reputationPosted Jul 4, 2013, 11:50 PM EDT
Regards,
Iftikar
Sunny SharmaRank #223 · 11.1K reputationPosted Jul 5, 2013, 12:02 AM EDT
I think the error lies somewhere out of this code section.
In this code snippet, there's no mention of an Image type, so how could it generate an error like-"couldn't find image"?
-----------------------------
----------------------------------------
I suggest you use breakpoint in your codes and check what line or lines of code is causing the problem.
Happy Coding :)