Who can help me?? Microsoft Visual Studio 2008 Window Form Application C#

I'm want store some data and picture in access database and display the data and picture in datagridview. when the user double click the record in datagridview. it will display data and picture into above textbox for update purpose.

check this link.... and this link.... I also came across an old thread here

To place your picture in textbox check this thread

Can u send me full example. Cos i'm still not very clear to know

I'm successful add image to access database. Now I'm want retrieve image.
For example, I'm want to double click record in datagridview and then display image into picturebox.

Edited 5 Years Ago by lianpiau: n/a

Insert the following code in the Click event procedure of Button2 (Database to PictureBox). This code retrieves the rows from the BLOBTest table in the database into a DataSet, copies the most recently added image into a Byte array and then into a MemoryStream object, and then loads the MemoryStream into the Image property of the PictureBox control.

try
{
	SqlConnection cn = new SqlConnection(strCn);
	cn.Open();

	//Retrieve BLOB from database into DataSet.
	SqlCommand cmd = new SqlCommand("SELECT BLOBID, BLOBData FROM BLOBTest ORDER BY BLOBID", cn);	
	SqlDataAdapter da = new SqlDataAdapter(cmd);
	DataSet ds = new DataSet();
	da.Fill(ds, "BLOBTest");
	int c = ds.Tables["BLOBTest"].Rows.Count;

	if(c>0)
	{   //BLOB is read into Byte array, then used to construct MemoryStream,
		//then passed to PictureBox.
		Byte[] byteBLOBData =  new Byte[0];
		byteBLOBData = (Byte[])(ds.Tables["BLOBTest"].Rows[c - 1]["BLOBData"]);
		MemoryStream stmBLOBData = new MemoryStream(byteBLOBData);
		pictureBox1.Image= Image.FromStream(stmBLOBData);
	} 
	cn.Close();
}
catch(Exception ex)
{MessageBox.Show(ex.Message);}

Also check "retrieve image from access db to picturebox" an old thread in this community

Edited 5 Years Ago by abelLazm: n/a

Insert the following code in the Click event procedure of Button2 (Database to PictureBox). This code retrieves the rows from the BLOBTest table in the database into a DataSet, copies the most recently added image into a Byte array and then into a MemoryStream object, and then loads the MemoryStream into the Image property of the PictureBox control.

try
{
	SqlConnection cn = new SqlConnection(strCn);
	cn.Open();

	//Retrieve BLOB from database into DataSet.
	SqlCommand cmd = new SqlCommand("SELECT BLOBID, BLOBData FROM BLOBTest ORDER BY BLOBID", cn);	
	SqlDataAdapter da = new SqlDataAdapter(cmd);
	DataSet ds = new DataSet();
	da.Fill(ds, "BLOBTest");
	int c = ds.Tables["BLOBTest"].Rows.Count;

	if(c>0)
	{   //BLOB is read into Byte array, then used to construct MemoryStream,
		//then passed to PictureBox.
		Byte[] byteBLOBData =  new Byte[0];
		byteBLOBData = (Byte[])(ds.Tables["BLOBTest"].Rows[c - 1]["BLOBData"]);
		MemoryStream stmBLOBData = new MemoryStream(byteBLOBData);
		pictureBox1.Image= Image.FromStream(stmBLOBData);
	} 
	cn.Close();
}
catch(Exception ex)
{MessageBox.Show(ex.Message);}

Also check "retrieve image from access db to picturebox" an old thread in this community

thanks.I'm slove my problem already.

This article has been dead for over six months. Start a new discussion instead.