I am able to add and retrieve image from database.
PROBLEM: I want to update image in database i.e. to replace the existing image with the new one or the same which i have retrieved from the database.
I am using this code to retrieve image from database and its working,
MemoryStream ms = new MemoryStream((byte[])dr["Photo"]);
curImage = Image.FromStream(ms);
pbImage.Image = curImage;
I am using this code to update image in database and its not working,
FileStream file = new FileStream(filename, FileMode.OpenOrCreate, FileAccess.Read);
byte[] rawdata = new byte[file.Length];
file.Read(rawdata, 0, System.Convert.ToInt32(file.Length));
file.Close();
cmdSave.Parameters.Add(new SqlParameter("@photo", rawdata));
Suppose the user doesn't want to update image, he just want to update other values such as name,contactno. etc and when the user clicks the update button the existing image should get updated along with other values
All i need is to update the image in database with the same image that i have retrieved or with a new image.
I have not got the solution yet. The 1st answer is not the solution.
please help...asap