this code inserts in the database
private void btnSave_Click(object sender, EventArgs e)
{
byte[] imageBt = null;
FileStream fstream = new F
Note:
CellClick
event you should check if click is not on row header or column headere.RowIndex
is row index of clicked cell, and e.ColumnIndex
is index of column of clicked cellyourDGV.Rows[e.RowIndex].Cells["GridColumnName"].value
yourDGV.Rows[e.RowIndex].Cells[2].Value
((DataRowView)yourDGV.Rows[e.RowIndex].DataBoundItem)[2]
((DataRowView)yourDGV.Rows[e.RowIndex].DataBoundItem)["DataTableColumnName"]
CellClick
because you load data in form load event and so all values including CCImage is present id your data table. So I removed it. It seems that you should fill it only when you want to load data not here in cell click.For example your code may like this:
private void abaanaCCDataGridView_CellClick(object sender, DataGridViewCellEventArgs e)
{
if (e.RowIndex < 0 || e.ColumnIndex < 0)
return;
this.Ptxtspn_code.Text = this.abaanaCCDataGridView.Rows[e.RowIndex].Cells[this.dataGridViewTextBoxColumn2.Name].Value.ToString();
byte[] mydata = (byte[])this.abaanaDataSet.abaanaCC.Rows[r.RowIndex]["CCImage"];
MemoryStream stream = new MemoryStream(mydata);
this.PpicBox.Image =Image.FromStream(stream);
}