Dear Nishantha,
I hope that you are using SQL Server to store the images. Here is the code that I use in my project to insert profile pictures to the Database.
string FileName = "";
Byte[] img = new byte[0];
FileDialog filedialog = new OpenFileDialog();
filedialog.ShowDialog();
FileName = filedialog.FileName;
yourPictureBox.ImageLocation = FileName;
if (FileName.Length > 0)
{
FileStream fs = new FileStream(FileName, FileMode.Open);
img = new Byte[fs.Length];
fs.Read(img, 0, (int)fs.Length);
fs.Close();
}
Kushan Randima
Software Engineer
DigiteQ Solutions PVT LTD