I am developing a sales system, using Visual Studio 2013 and SQL 2008, for some inconveniences I started to use Visual Studio 2012, I happen to have an error. The code is correct but when running this displays error, in how much I used Visual Studio 2013 I ran normally.
private void dgv_Artigo_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
{
this.txt_ID.Text = dgv_Artigo[0, dgv_Artigo.CurrentRow.Index].Value.ToString();
this.txt_CodBarra.Text = dgv_Artigo[1, dgv_Artigo.CurrentRow.Index].Value.ToString();
this.txt_Artigo.Text = dgv_Artigo[2, dgv_Artigo.CurrentRow.Index].Value.ToString();
this.cb_Categoria.Text = dgv_Artigo[5, dgv_Artigo.CurrentRow.Index].Value.ToString();
this.cb_TipoArtigo.Text = dgv_Artigo[6, dgv_Artigo.CurrentRow.Index].Value.ToString();
SqlConnection conexao = new SqlConnection(CN);
SqlDataAdapter adp = new SqlDataAdapter("SELECT * FROM view_artigo where id_artigo = '" + dgv_Artigo.SelectedRows[0].Cells[4].Value.ToString() + "'", conexao);
DataTable dt = new DataTable();
adp.Fill(dt);
byte[] imagembinaria = (byte[])dt.Rows[0][0];
Bitmap ima;
using (MemoryStream ms = new MemoryStream(imagembinaria))
{
ima = new Bitmap(ms);
}
pt_imagem.Image = ima;
tabControl1.SelectTab(tabPage1);
}