c#datagridview не получается обработать CellMouseClick для Image

в базу данных грузиться данные с изображением, после отображается в Datagridview с помощью CellMouseClick. проблема возникает с изображением , сохраняется в базу данных но не отображается, помогите пожалуйста разобраться с этим. ниже выложил код

class CellMouseClick
{
    
    public static void CellMouseClickk(int tb, TextBox textBox1, TextBox textBox2, TextBox textBox3, TextBox textBox4, TextBox textBox5, TextBox textBox6, TextBox textBox7, TextBox textBox8, TextBox textBox9, TextBox textBox10, TextBox textBox11, TextBox textBox12, TextBox textBox13, TextBox textBox14, TextBox textBox15, TextBox textBox16, TextBox textBox17, TextBox textBox18, TextBox textBox19, TextBox textBox20, TextBox textBox21, TextBox textBox22, TextBox textBox23, ComboBox comboBox1, ComboBox comboBox2, ComboBox comboBox3, ComboBox comboBox4, ComboBox comboBox5, ComboBox comboBox6, ComboBox comboBox7, ComboBox comboBox8, DataGridView dataGridView1, PictureBox picture, byte[] img)
      
    {
        MemoryStream ms = new MemoryStream();
        picture.Image.Save(ms, picture.Image.RawFormat);
       img = ms.ToArray();
        tb = Convert.ToInt32(dataGridView1.CurrentRow.Cells[0].Value.ToString());
        textBox1.Text = dataGridView1.CurrentRow.Cells[1].Value.ToString();
        comboBox1.Text = dataGridView1.CurrentRow.Cells[2].Value.ToString();
        comboBox2.Text = dataGridView1.CurrentRow.Cells[3].Value.ToString();
        textBox2.Text = dataGridView1.CurrentRow.Cells[4].Value.ToString();
        textBox3.Text = dataGridView1.CurrentRow.Cells[5].Value.ToString();
        textBox4.Text = dataGridView1.CurrentRow.Cells[6].Value.ToString();
        textBox5.Text = dataGridView1.CurrentRow.Cells[7].Value.ToString();
        textBox6.Text = dataGridView1.CurrentRow.Cells[8].Value.ToString();
        textBox7.Text = dataGridView1.CurrentRow.Cells[9].Value.ToString();
        textBox8.Text = dataGridView1.CurrentRow.Cells[11].Value.ToString();
        comboBox3.Text = dataGridView1.CurrentRow.Cells[10].Value.ToString();
        textBox9.Text = dataGridView1.CurrentRow.Cells[12].Value.ToString();
        textBox10.Text = dataGridView1.CurrentRow.Cells[13].Value.ToString();
        textBox11.Text = dataGridView1.CurrentRow.Cells[14].Value.ToString();
        textBox12.Text = dataGridView1.CurrentRow.Cells[15].Value.ToString();
        textBox13.Text = dataGridView1.CurrentRow.Cells[16].Value.ToString();
        textBox14.Text = dataGridView1.CurrentRow.Cells[17].Value.ToString();
        textBox15.Text = dataGridView1.CurrentRow.Cells[18].Value.ToString();
        comboBox4.Text = dataGridView1.CurrentRow.Cells[19].Value.ToString();
        textBox16.Text = dataGridView1.CurrentRow.Cells[20].Value.ToString();
        comboBox5.Text = dataGridView1.CurrentRow.Cells[21].Value.ToString();
        textBox17.Text = dataGridView1.CurrentRow.Cells[22].Value.ToString();
        comboBox6.Text = dataGridView1.CurrentRow.Cells[23].Value.ToString();
        textBox18.Text = dataGridView1.CurrentRow.Cells[24].Value.ToString();
        comboBox7.Text = dataGridView1.CurrentRow.Cells[25].Value.ToString();
        textBox19.Text = dataGridView1.CurrentRow.Cells[26].Value.ToString();
        textBox21.Text = dataGridView1.CurrentRow.Cells[27].Value.ToString();
        textBox22.Text = dataGridView1.CurrentRow.Cells[28].Value.ToString();
        textBox23.Text = dataGridView1.CurrentRow.Cells[29].Value.ToString();
        picture.Image = img.(dataGridView1.CurrentRow.Cells[30].Value);
    }

   
}

}

код добавление изображение в базу данных

 private void button5_Click(object sender, EventArgs e)
    {
        try
        {
            spisok();
            MemoryStream ms = new MemoryStream();
            pictureBox1.Image.Save(ms, pictureBox1.Image.RawFormat);
            byte[] img = ms.ToArray();
            string query = "insert into Employee(id, name, satstype, year, prefix, size, freesize, internet_size, freesizeint, workintnumber, abonplata, dslam48, dslam128, dslam288, dslam896, kabel30, kabel50, kabel100, kabel200, dizelwork, mosnost, dizelyear, errorport, akkumwork, akkumworktime, akkumamount, montyor, geolocationc, geolocationb, location, image) Values (@id, @name, @satstype, @year, @prefix, @size, @freesize, @internet_size, @freesizeint, @workintnumber, @abonplata, @dslam48, @dslam128, @dslam288, @dslam896, @kabel30, @kabel50, @kabel100, @kabel200, @dizelwork, @mosnost, @dizelyear, @errorport, @akkumwork, @akkumworktime, @akkumamount, @montyor, @geolocationc, @geolocationb, @location, @img)";


            this.dataGridView1.DataSource = AutoNumberedTable(dt);
            con.Open();

            MySqlCommand cmd = new MySqlCommand(query, con);

            cmd.Parameters.Add("@id", MySqlDbType.Int32, 100).Value = null;
            cmd.Parameters.Add("@name", MySqlDbType.VarChar, 60).Value = textBox1.Text;
            cmd.Parameters.Add("@satstype", MySqlDbType.VarChar, 50).Value = comboBox1.Text;
            cmd.Parameters.Add("@year", MySqlDbType.VarChar, 20).Value = comboBox2.Text;
            cmd.Parameters.Add("@prefix", MySqlDbType.VarChar, 50).Value = textBox2.Text;
            cmd.Parameters.Add("@size", MySqlDbType.Int32, 100).Value = textBox3.Text;
            cmd.Parameters.Add("@freesize", MySqlDbType.Int32, 100).Value = textBox4.Text;
            cmd.Parameters.Add("@internet_size", MySqlDbType.Int32, 100).Value = textBox5.Text;
            cmd.Parameters.Add("@freesizeint", MySqlDbType.VarChar, 20).Value = textBox6.Text;
            cmd.Parameters.Add("@workintnumber", MySqlDbType.VarChar, 20).Value = textBox7.Text;
            cmd.Parameters.Add("@abonplata", MySqlDbType.VarChar, 20).Value = comboBox3.Text;
            cmd.Parameters.Add("@dslam48", MySqlDbType.VarChar, 20).Value = textBox8.Text;
            cmd.Parameters.Add("@dslam128", MySqlDbType.VarChar, 20).Value = textBox9.Text;
            cmd.Parameters.Add("@dslam288", MySqlDbType.VarChar, 20).Value = textBox10.Text;
            cmd.Parameters.Add("@dslam896", MySqlDbType.VarChar, 20).Value = textBox11.Text;
            cmd.Parameters.Add("@kabel30", MySqlDbType.VarChar, 20).Value = textBox12.Text;
            cmd.Parameters.Add("@kabel50", MySqlDbType.VarChar, 20).Value = textBox13.Text;
            cmd.Parameters.Add("@kabel100", MySqlDbType.VarChar, 20).Value = textBox14.Text;
            cmd.Parameters.Add("@kabel200", MySqlDbType.VarChar, 20).Value = textBox15.Text;
            cmd.Parameters.Add("@dizelwork", MySqlDbType.VarChar, 50).Value = comboBox4.Text;
            cmd.Parameters.Add("@mosnost", MySqlDbType.VarChar, 20).Value = textBox16.Text;
            cmd.Parameters.Add("@dizelyear", MySqlDbType.VarChar, 20).Value = comboBox5.Text;
            cmd.Parameters.Add("@errorport", MySqlDbType.VarChar, 20).Value = textBox17.Text;
            cmd.Parameters.Add("@akkumwork", MySqlDbType.VarChar, 50).Value = comboBox6.Text;
            cmd.Parameters.Add("@akkumworktime", MySqlDbType.VarChar, 20).Value = textBox18.Text;
            cmd.Parameters.Add("@akkumamount", MySqlDbType.VarChar, 20).Value = comboBox7.Text;
            cmd.Parameters.Add("@montyor", MySqlDbType.VarChar, 50).Value = textBox19.Text;
            cmd.Parameters.Add("@geolocationc", MySqlDbType.VarChar, 50).Value = textBox21.Text;
            cmd.Parameters.Add("@geolocationb", MySqlDbType.VarChar, 50).Value = textBox22.Text;
            cmd.Parameters.Add("@location", MySqlDbType.VarChar, 100).Value = textBox23.Text;
            cmd.Parameters.Add("@img", MySqlDbType.LongBlob).Value = img;
            if (cmd.ExecuteNonQuery() == 1)
            {
                MessageBox.Show("Added");
            }

            con.Close();


           
        }
        catch (Exception ex)
        {
            MessageBox.Show(ex.Message, "Error!");
            con.Close();
        }
    }

 public void spisok()
    {
        con.Open();

        MySqlDataAdapter adapter = new MySqlDataAdapter(" SELECT* FROM `Employee` ", con);
        DataSet dset = new DataSet();
        adapter.Fill(dset);
        dataGridView1.DataSource = dset.Tables[0];
        con.Close();
    }

Ответы (0 шт):