how to show image in picture box from access database

Posted by Shanky11 under Windows Forms on 10/20/2014 | Points: 10 | Views : 648 | Status : [Member] | Replies : 0
i am using this code:
save is okk
when i tried to retrieve the image t shows error
..........'Parameter not Valid';

public static byte[] ImageToByte(Image img)
ImageConverter converter = new ImageConverter();
return (byte[])converter.ConvertTo(img, typeof(byte[]));
public static Image ImageFromByte(byte[] image)
ImageConverter ic = new ImageConverter();
Image img = (Image)ic.ConvertFrom(image);
return img;
///////////////////Save Code
byte[] img = ImageToByte(pictureBox1.Image);

int count = img.Length;
data.insert("insert into itemimage(itemname,photo)values('" + textBox1.Text + "','" +img+ "')");

/////////Retrieve image in pic box
private void button3_Click(object sender, EventArgs e)
DataSet ds= data.display("select photo from itemimage where itemname='"+textBox1.Text+"'");
byte[]b= (byte[])ds.Tables[0].Rows[0]["photo"];
Image photo=ImageFromByte(b);
pictureBox1.Image = photo;
// pictureBox1.Image = ByteArrayToImage((Byte[])ds.Tables[0].Rows[0]["photo"]);


(No response found.)

Login to post response