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 .....................
Sunny SharmaPosted Jul 5, 2013, 4:02 AM
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 :)
Iftikar HussainPosted Jul 5, 2013, 3:50 AM
Regards,
Iftikar
Iftikar HussainPosted Jul 5, 2013, 3:03 AM
Regards,
Iftikar
Sanjeeb LenkaPosted Jul 5, 2013, 2:51 AM
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 HussainPosted Jul 5, 2013, 2:41 AM
Are you trying to store the image or just image file in DB?
Regards,
Iftikar