Thank You Bro. But its not working.
Just Look at my code in gridview click event :
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
if (e.RowIndex >= 0)
{
try
{
DataGridViewRow row = dataGridView1.Rows[e.RowIndex];
Txt_EmpID.Text = row.Cells[0].Value.ToString();
Txt_EmpName.Text = row.Cells[1].Value.ToString();
Txt_Passport.Text = row.Cells[2].Value.ToString();
Dtp_PpExpiry.Text = row.Cells[3].Value.ToString();
txt_Address1.Text = row.Cells[4].Value.ToString();
Txt_Address2.Text = row.Cells[5].Value.ToString();
dtpDOB.Text = row.Cells[6].Value.ToString();
Txt_Emergency.Text = row.Cells[7].Value.ToString();
Txt_Emerg2.Text = row.Cells[8].Value.ToString();
Txt_Bank.Text = row.Cells[9].Value.ToString();
Txt_Dl.Text = row.Cells[10].Value.ToString()
MessageBox.Show("Loading Data");
}
catch (Exception ex)
{
MessageBox.Show("Error" + ex);
}
}
RetriveImage();
}<pre lang="cs">
<pre lang="cs">void RetriveImage()
{
OleDbConnection DBConnection = new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\Administrator\Desktop\EmployeeData.accdb");
DBConnection.Open();
using (DBConnection)
{
Image img;
byte[] photo;
OleDbCommand cmd = new OleDbCommand("SELECT img From EmployeeData where EmpID=4", DBConnection);
OleDbDataReader reader = cmd.ExecuteReader();
while (reader.Read())
{
photo = (byte[])reader.GetValue(0);
MemoryStream ms = new MemoryStream(photo);
img = Image.FromStream(ms);
pictureBox1.Image = img;
}
}
DBConnection.Close();
}
<pre lang="cs">