private void btnBrowse_Click(object sender, EventArgs e)
{
OpenFileDialog dlg = new OpenFileDialog();
dlg.Title = "Open Photo";
dlg.Filter = "jpg files(*.jpg|*.jpg|All files(*.*)|*.*";
if (dlg.ShowDialog() == DialogResult.OK)
{
pictureBox1.Image = new Bitmap(dlg.OpenFile());
}
dlg.Dispose();
}
private void btnAdd_Click(object sender,EventArgs e)
{
MemoryStream ms = new MemoryStream();
pictureBox1.Image.Save(ms, ImageFormat.Jpeg);
ms.Position = 0;
ms.Read(photo, 0, Convert.ToInt32(photo.Length));
pinfo.profilepic=photo//here i am getting error why because the datatype convertion problem.photo is Byte[] type and profilepic is Binary type
}
please give me answer
Loading
paddu vPosted Jun 29, 2012, 3:59 AM
How to Convert Byte[] type to Binary Type
Satyapriya NayakPosted Jun 28, 2012, 1:55 PM
Please refer the below link
http://dotnetaid.com/2011/08/03/inserting-image-into-database-in-c-net-window-application/
Thanks